r-hyperspec / hyperSpec

hyperSpec: Tools for Spectroscopy (R package)
https://r-hyperspec.github.io/hyperSpec/
GNU General Public License v3.0
12 stars 3 forks source link

Error in `read.spc()` with R 4.2.0 #80

Closed henningte closed 2 years ago

henningte commented 2 years ago

read.spc() throws the warning in the reprex below with R 4.2.0. This warning will become an error in R-devel within a week (see https://www.stats.ox.ac.uk/pub/bdr/LENGTH1/00README.txt).

I have just today published an R package 'ir' on CRAN which depends on 'hyperSpec' for importing spc files. Also today, I got the message that 'ir' will be removed if this issue does not get fixed until 2022-05-09. I don't know if you have received a message from CRAN reporting this error --- perhaps not if there are no tests for read.spc().


Here's the reprex throwing the warning

library(hyperSpec)
#> Loading required package: lattice
#> Loading required package: grid
#> Loading required package: ggplot2
#> Loading required package: xml2
#> Package hyperSpec, version 0.100.0
#> 
#> To get started, try
#>    vignette ("hyperspec")
#>    package?hyperSpec 
#>    vignette (package = "hyperSpec")
#> 
#> If you use this package please cite it appropriately.
#>    citation("hyperSpec")
#> will give you the correct reference.
#> 
#> The project homepage is http://hyperspec.r-forge.r-project.org

x <- 
  hyperSpec::read.spc(
    system.file("extdata/1.spc", package = "ir"),
    log.txt = TRUE,
    log.bin = TRUE,
    log.disk = TRUE,
    keys.hdr2data = TRUE,
    keys.log2data = TRUE,
    no.object = FALSE
  )
#> Warning in length(pos) == 1 && pos[[1]] == -1: 'length(x) = 11 > 1' in coercion
#> to 'logical(1)'

Created on 2022-04-25 by the reprex package (v2.0.1)

Session info ``` r sessioninfo::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R version 4.2.0 (2022-04-22 ucrt) #> os Windows 10 x64 (build 19044) #> system x86_64, mingw32 #> ui RTerm #> language (EN) #> collate German_Germany.utf8 #> ctype German_Germany.utf8 #> tz Europe/Berlin #> date 2022-04-25 #> pandoc 2.17.1.1 @ C:/Program Files/RStudio/bin/quarto/bin/ (via rmarkdown) #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> package * version date (UTC) lib source #> brio 1.1.3 2021-11-30 [1] CRAN (R 4.2.0) #> cli 3.3.0 2022-04-25 [1] CRAN (R 4.2.0) #> colorspace 2.0-3 2022-02-21 [1] CRAN (R 4.2.0) #> crayon 1.5.1 2022-03-26 [1] CRAN (R 4.2.0) #> digest 0.6.29 2021-12-01 [1] CRAN (R 4.2.0) #> dplyr 1.0.8 2022-02-08 [1] CRAN (R 4.2.0) #> ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.2.0) #> evaluate 0.15 2022-02-18 [1] CRAN (R 4.2.0) #> fansi 1.0.3 2022-03-24 [1] CRAN (R 4.2.0) #> fastmap 1.1.0 2021-01-25 [1] CRAN (R 4.2.0) #> fs 1.5.2 2021-12-08 [1] CRAN (R 4.2.0) #> generics 0.1.2 2022-01-31 [1] CRAN (R 4.2.0) #> ggplot2 * 3.3.5 2021-06-25 [1] CRAN (R 4.2.0) #> glue 1.6.2 2022-02-24 [1] CRAN (R 4.2.0) #> gtable 0.3.0 2019-03-25 [1] CRAN (R 4.2.0) #> highr 0.9 2021-04-16 [1] CRAN (R 4.2.0) #> htmltools 0.5.2 2021-08-25 [1] CRAN (R 4.2.0) #> hyperSpec * 0.100.0 2021-09-13 [1] CRAN (R 4.2.0) #> jpeg 0.1-9 2021-07-24 [1] CRAN (R 4.2.0) #> knitr 1.38 2022-03-25 [1] CRAN (R 4.2.0) #> lattice * 0.20-45 2021-09-22 [2] CRAN (R 4.2.0) #> latticeExtra 0.6-29 2019-12-19 [1] CRAN (R 4.2.0) #> lazyeval 0.2.2 2019-03-15 [1] CRAN (R 4.2.0) #> lifecycle 1.0.1 2021-09-24 [1] CRAN (R 4.2.0) #> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.2.0) #> munsell 0.5.0 2018-06-12 [1] CRAN (R 4.2.0) #> pillar 1.7.0 2022-02-01 [1] CRAN (R 4.2.0) #> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.2.0) #> png 0.1-7 2013-12-03 [1] CRAN (R 4.2.0) #> purrr 0.3.4 2020-04-17 [1] CRAN (R 4.2.0) #> R6 2.5.1 2021-08-19 [1] CRAN (R 4.2.0) #> RColorBrewer 1.1-3 2022-04-03 [1] CRAN (R 4.2.0) #> reprex 2.0.1 2021-08-05 [1] CRAN (R 4.2.0) #> rlang 1.0.2 2022-03-04 [1] CRAN (R 4.2.0) #> rmarkdown 2.13 2022-03-10 [1] CRAN (R 4.2.0) #> rstudioapi 0.13 2020-11-12 [1] CRAN (R 4.2.0) #> scales 1.2.0 2022-04-13 [1] CRAN (R 4.2.0) #> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.2.0) #> stringi 1.7.6 2021-11-29 [1] CRAN (R 4.2.0) #> stringr 1.4.0 2019-02-10 [1] CRAN (R 4.2.0) #> testthat 3.1.3 2022-03-29 [1] CRAN (R 4.2.0) #> tibble 3.1.6 2021-11-07 [1] CRAN (R 4.2.0) #> tidyselect 1.1.2 2022-02-21 [1] CRAN (R 4.2.0) #> utf8 1.2.2 2021-07-24 [1] CRAN (R 4.2.0) #> vctrs 0.4.1 2022-04-13 [1] CRAN (R 4.2.0) #> withr 2.5.0 2022-03-03 [1] CRAN (R 4.2.0) #> xfun 0.30 2022-03-02 [1] CRAN (R 4.2.0) #> xml2 * 1.3.3 2021-11-30 [1] CRAN (R 4.2.0) #> yaml 2.3.5 2022-02-21 [1] CRAN (R 4.2.0) #> #> [1] C:/Users/henni/AppData/Local/R/win-library/4.2 #> [2] C:/Program Files/R/R-4.2.0/library #> #> ────────────────────────────────────────────────────────────────────────────── ```

The sample spc file can be found as external data in the 'ir' package.


I have traced back the error to this line in .spc.log():

https://github.com/r-hyperspec/hyperSpec/blob/66f31c568ec909c107b3541f5601c7f4fba391d1/R/DEPRECATED-read.spc.R#L557

(I've seen that the current CRAN version code is a bit different here)

And ultimately, the warning (error) is caused by this line in split.string():

https://github.com/r-hyperspec/hyperSpec/blob/66f31c568ec909c107b3541f5601c7f4fba391d1/R/DEPRECATED-read.spc.R#L902

The problem is that with the sample spc file, pos is a list:

> pos
[[1]]
 [1]  18  30  40  56  74  88 102 122 154 163 183
attr(,"match.length")
 [1] 2 2 2 2 2 2 2 2 2 2 2
attr(,"index.type")
[1] "chars"
attr(,"useBytes")
[1] TRUE

And the first element (as used in split.string()) --- pos[[1]] --- is:

> pos[[1]]
 [1]  18  30  40  56  74  88 102 122 154 163 183
attr(,"match.length")
 [1] 2 2 2 2 2 2 2 2 2 2 2
attr(,"index.type")
[1] "chars"
attr(,"useBytes")
[1] TRUE

i.e. a vector. For this reason, the line in split.string() returns a logical vector with more than one element which causes the warning.

Unfortunately, I have no deeper knowledge on the decoding of the spc files in hyperSpec, so I don't know what would be the best option to fix this warning (error). Naively, I would suggest (assuming pos[[1]] is supposed to refer to the first position in pos) to write pos[[1]][[1]] instead of pos[[1]].

If you have any idea here, this would be great. I have seen that the hyperSpec package is under heavy development right now and that the read.spc() function gets its own sub-package. I don't know what solution would fit into your plan.

Please let me know if you cannot resolve this soon such that I can adopt 'ir' to avoid it from being removed from CRAN (e.g. by temporarily removing the example).


Edit: I've tested if the warning (error) also occurs with the current GitHub version of both 'hyperSpec' and 'hySpc.read.spc' (and I can confirm this):

library(hyperSpec)
#> Loading required package: lattice
#> Loading required package: grid
#> Loading required package: ggplot2
#> Warning: replacing previous import 'lazyeval::f_env<-' by 'rlang::f_env<-' when
#> loading 'hyperSpec'
#> Warning: replacing previous import 'lazyeval::as_name' by 'rlang::as_name' when
#> loading 'hyperSpec'
#> Warning: replacing previous import 'lazyeval::f_lhs<-' by 'rlang::f_lhs<-' when
#> loading 'hyperSpec'
#> Warning: replacing previous import 'lazyeval::is_formula' by 'rlang::is_formula'
#> when loading 'hyperSpec'
#> Warning: replacing previous import 'lazyeval::call_standardise' by
#> 'rlang::call_standardise' when loading 'hyperSpec'
#> Warning: replacing previous import 'lazyeval::f_rhs<-' by 'rlang::f_rhs<-' when
#> loading 'hyperSpec'
#> Warning: replacing previous import 'lazyeval::expr_text' by 'rlang::expr_text'
#> when loading 'hyperSpec'
#> Warning: replacing previous import 'lazyeval::f_text' by 'rlang::f_text' when
#> loading 'hyperSpec'
#> Warning: replacing previous import 'lazyeval::missing_arg' by
#> 'rlang::missing_arg' when loading 'hyperSpec'
#> Warning: replacing previous import 'lazyeval::call_modify' by
#> 'rlang::call_modify' when loading 'hyperSpec'
#> Warning: replacing previous import 'lazyeval::expr_label' by 'rlang::expr_label'
#> when loading 'hyperSpec'
#> Warning: replacing previous import 'lazyeval::is_pairlist' by
#> 'rlang::is_pairlist' when loading 'hyperSpec'
#> Warning: replacing previous import 'lazyeval::is_atomic' by 'rlang::is_atomic'
#> when loading 'hyperSpec'
#> Warning: replacing previous import 'lazyeval::f_label' by 'rlang::f_label' when
#> loading 'hyperSpec'
#> Warning: replacing previous import 'lazyeval::f_rhs' by 'rlang::f_rhs' when
#> loading 'hyperSpec'
#> Warning: replacing previous import 'lazyeval::is_lang' by 'rlang::is_lang' when
#> loading 'hyperSpec'
#> Warning: replacing previous import 'lazyeval::f_env' by 'rlang::f_env' when
#> loading 'hyperSpec'
#> Warning: replacing previous import 'lazyeval::is_call' by 'rlang::is_call' when
#> loading 'hyperSpec'
#> Warning: replacing previous import 'lazyeval::f_lhs' by 'rlang::f_lhs' when
#> loading 'hyperSpec'
#> Warning: replacing previous import 'dplyr::matches' by 'testthat::matches' when
#> loading 'hyperSpec'
#> Warning: replacing previous import 'rlang::is_null' by 'testthat::is_null' when
#> loading 'hyperSpec'
#> Warning: replacing previous import 'rlang::is_false' by 'testthat::is_false'
#> when loading 'hyperSpec'
#> Warning: replacing previous import 'rlang::is_true' by 'testthat::is_true' when
#> loading 'hyperSpec'
#> Warning: replacing previous import 'rlang::as_list' by 'xml2::as_list' when
#> loading 'hyperSpec'
#> Warning: replacing previous import 'latticeExtra::layer' by 'ggplot2::layer'
#> when loading 'hyperSpec'
#> 
#> 
#> Package hyperSpec (version 0.200.0.9000)
#> 
#> To get started, try: 
#>    vignette("hyperSpec", package = "hyperSpec")
#>    package?hyperSpec
#>    browseVignettes(package = "hyperSpec")
#>    vignette(package = "hyperSpec")
#> 
#> If you use this package, please cite it appropriately.
#> The correct reference is given by:
#>    citation("hyperSpec")
#> 
#> The project's website:
#>    https://r-hyperspec.github.io/hyperSpec
#> 
#> IMPORTANT! 
#> Existing users of 'hyperSpec' will find that many functions either have been renamed in favor of more consistent names or moved to other packages. To help you update your workflows, the list of the renamed and moved functions resides in the NEWS file of hyperSpec's documentation: 
#> 
#> help(package = "hyperSpec")
#> 
#> Attaching package: 'hyperSpec'
#> The following objects are masked from 'package:base':
#> 
#>     .colMeans, .colSums, .rowMeans, .rowSums, .subset

x <- 
  hyperSpec::read.spc(
    filename = system.file("extdata/1.spc", package = "ir"),
    log.txt = TRUE,
    log.bin = TRUE,
    log.disk = TRUE,
    keys.hdr2data = TRUE,
    keys.log2data = TRUE,
    no.object = FALSE
  )
#> Warning: Function 'hyperSpec::read.spc' is deprecated. 
#> Please, find alternatives in package 'hySpc.read.spc'
#> https://r-hyperspec.github.io/hySpc.read.spc
#> Warning in length(pos) == 1 && pos[[1]] == -1: 'length(x) = 11 > 1' in coercion
#> to 'logical(1)'

library(hySpc.read.spc)
#> 
#> Attaching package: 'hySpc.read.spc'
#> The following objects are masked from 'package:hyperSpec':
#> 
#>     .prepare.hdr.df, .spc.error, .spc.filehdr, .spc.ftflags, .spc.log,
#>     .spc.read.x, .spc.read.y, .spc.subfiledir, .spc.subhdr, .spc.xlab,
#>     .spc.ylab, getbynames, raw.split.nul, read.spc, read.spc.Kaiser,
#>     read.spc.KaiserLowHigh, read.spc.KaiserMap, split.line,
#>     split.string

x <- 
  hySpc.read.spc::read.spc(
    filename = system.file("extdata/1.spc", package = "ir"),
    log.txt = TRUE,
    log.bin = TRUE,
    log.disk = TRUE,
    keys.hdr2data = TRUE,
    keys.log2data = TRUE,
    no.object = FALSE
  )
#> Warning in length(pos) == 1 && pos[[1]] == -1: 'length(x) = 11 > 1' in coercion
#> to 'logical(1)'

Created on 2022-04-25 by the reprex package (v2.0.1)

Session info ``` r sessioninfo::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R version 4.2.0 (2022-04-22 ucrt) #> os Windows 10 x64 (build 19044) #> system x86_64, mingw32 #> ui RTerm #> language (EN) #> collate German_Germany.utf8 #> ctype German_Germany.utf8 #> tz Europe/Berlin #> date 2022-04-25 #> pandoc 2.17.1.1 @ C:/Program Files/RStudio/bin/quarto/bin/ (via rmarkdown) #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> package * version date (UTC) lib source #> brio 1.1.3 2021-11-30 [1] CRAN (R 4.2.0) #> cli 3.3.0 2022-04-25 [1] CRAN (R 4.2.0) #> colorspace 2.0-3 2022-02-21 [1] CRAN (R 4.2.0) #> crayon 1.5.1 2022-03-26 [1] CRAN (R 4.2.0) #> digest 0.6.29 2021-12-01 [1] CRAN (R 4.2.0) #> dplyr 1.0.8 2022-02-08 [1] CRAN (R 4.2.0) #> ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.2.0) #> evaluate 0.15 2022-02-18 [1] CRAN (R 4.2.0) #> fansi 1.0.3 2022-03-24 [1] CRAN (R 4.2.0) #> fastmap 1.1.0 2021-01-25 [1] CRAN (R 4.2.0) #> fs 1.5.2 2021-12-08 [1] CRAN (R 4.2.0) #> generics 0.1.2 2022-01-31 [1] CRAN (R 4.2.0) #> ggplot2 * 3.3.5 2021-06-25 [1] CRAN (R 4.2.0) #> glue 1.6.2 2022-02-24 [1] CRAN (R 4.2.0) #> gtable 0.3.0 2019-03-25 [1] CRAN (R 4.2.0) #> highr 0.9 2021-04-16 [1] CRAN (R 4.2.0) #> htmltools 0.5.2 2021-08-25 [1] CRAN (R 4.2.0) #> hyperSpec * 0.200.0.9000 2022-04-25 [1] Github (r-hyperspec/hyperSpec@66f31c5) #> hySpc.read.spc * 0.0.0.9000 2022-04-25 [1] Github (r-hyperspec/hySpc.read.spc@8eb1f1a) #> hySpc.testthat 0.2.1.9000 2022-04-25 [1] Github (r-hyperspec/hySpc.testthat@3d046e3) #> jpeg 0.1-9 2021-07-24 [1] CRAN (R 4.2.0) #> knitr 1.38 2022-03-25 [1] CRAN (R 4.2.0) #> lattice * 0.20-45 2021-09-22 [2] CRAN (R 4.2.0) #> latticeExtra 0.6-29 2019-12-19 [1] CRAN (R 4.2.0) #> lazyeval 0.2.2 2019-03-15 [1] CRAN (R 4.2.0) #> lifecycle 1.0.1 2021-09-24 [1] CRAN (R 4.2.0) #> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.2.0) #> munsell 0.5.0 2018-06-12 [1] CRAN (R 4.2.0) #> pillar 1.7.0 2022-02-01 [1] CRAN (R 4.2.0) #> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.2.0) #> png 0.1-7 2013-12-03 [1] CRAN (R 4.2.0) #> purrr 0.3.4 2020-04-17 [1] CRAN (R 4.2.0) #> R.cache 0.15.0 2021-04-30 [1] CRAN (R 4.2.0) #> R.methodsS3 1.8.1 2020-08-26 [1] CRAN (R 4.2.0) #> R.oo 1.24.0 2020-08-26 [1] CRAN (R 4.2.0) #> R.utils 2.11.0 2021-09-26 [1] CRAN (R 4.2.0) #> R6 2.5.1 2021-08-19 [1] CRAN (R 4.2.0) #> RColorBrewer 1.1-3 2022-04-03 [1] CRAN (R 4.2.0) #> reprex 2.0.1 2021-08-05 [1] CRAN (R 4.2.0) #> rlang 1.0.2 2022-03-04 [1] CRAN (R 4.2.0) #> rmarkdown 2.13 2022-03-10 [1] CRAN (R 4.2.0) #> rstudioapi 0.13 2020-11-12 [1] CRAN (R 4.2.0) #> scales 1.2.0 2022-04-13 [1] CRAN (R 4.2.0) #> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.2.0) #> stringi 1.7.6 2021-11-29 [1] CRAN (R 4.2.0) #> stringr 1.4.0 2019-02-10 [1] CRAN (R 4.2.0) #> styler 1.7.0 2022-03-13 [1] CRAN (R 4.2.0) #> testthat 3.1.3 2022-03-29 [1] CRAN (R 4.2.0) #> tibble 3.1.6 2021-11-07 [1] CRAN (R 4.2.0) #> tidyselect 1.1.2 2022-02-21 [1] CRAN (R 4.2.0) #> utf8 1.2.2 2021-07-24 [1] CRAN (R 4.2.0) #> vctrs 0.4.1 2022-04-13 [1] CRAN (R 4.2.0) #> withr 2.5.0 2022-03-03 [1] CRAN (R 4.2.0) #> xfun 0.30 2022-03-02 [1] CRAN (R 4.2.0) #> xml2 1.3.3 2021-11-30 [1] CRAN (R 4.2.0) #> yaml 2.3.5 2022-02-21 [1] CRAN (R 4.2.0) #> #> [1] C:/Users/henni/AppData/Local/R/win-library/4.2 #> [2] C:/Program Files/R/R-4.2.0/library #> #> ────────────────────────────────────────────────────────────────────────────── ```
GegznaV commented 2 years ago

@cbeleites could you take care of this?

bryanhanson commented 2 years ago

This type of error has brought down other packages as well, like kableExtra which is very broadly used.

@eoduniyi might be the most knowledgeable to fix it in both packages but of course @cbeleites will have to submit the revision to CRAN.

Thanks @henningte for a careful and detailed explanation of the problem, this will expedite the repair.

bryanhanson commented 2 years ago

I am working on this, will push a branch hopefully in the next hour.

bryanhanson commented 2 years ago

https://github.com/r-hyperspec/hyperSpec/pull/81 @cbeleites has been requested to review, one oddball problem with vdiffr on Ubuntu during checks. Otherwise OK.

I will fix hySpc.read.spc in a similar fashion once this is approved.

cbeleites commented 2 years ago

Hi @bryanhanson, many thanks for taking care of this so fast. I had a glance at your solution but will need to think whether it actually does what we want to do.

I have a sneaking suspicion that we rather want to make sure x is of length 1, thus length(pos) will always be 1, and it will always be a list.
The intended check would then be if (length(pos[[1]]) == 1 && pos[[1]][1] == -1).

After all, we throw away all results on x[-1] in the next line.

I'd like to check what happens with @henningte 's test file, though.

cbeleites commented 2 years ago

@henningte

I don't know if you have received a message from CRAN reporting this error --- perhaps not if there are no tests for read.spc()

One of the reasons why we want to split hyperSpec into smaller packages is that the size limits on CRAN do not allow us to ship the test files which we have offline. For the smaller packages, we hope to either include them, or we'll provide the package outside CRAN on github.

bryanhanson commented 2 years ago
x <- "Vilmantas"
pos <- gregexpr("z", x)
if (length(pos) == 1 & pos[[1]][[1]] == -1) {
  cat("string was not split\n")
  # return(x)
}

But yes @cbeleites one could check it other ways, but the key thing is don't use &&, use &. CRAN wants a length one item compared to a length one item.

cbeleites commented 2 years ago

@bryanhanson I understood that CRAN wants a length 1 logical inside the if.

My reasoning is that we want to have a warning/error in situations like now because it actually reveals a bug in the code. pos[[1]][1] should be of length 1. Actually, if checking length(x) == 1 and length(pos[[1]]) == 1, we should be able to check whether pos[[1]] == -1, as before.

Whenever we encounter a warning/errror on that, we found a situation that is fundamentally outside what I was thinking about when writing this function.

I'm open to the argument that being forced to do hurried fixes due to CRAN finding something that was never checked before is worse, though. :-)

henningte commented 2 years ago

Thank you for handling the issue that quickly.

Here is a direct link to the sample spc file: https://github.com/henningte/ir/blob/main/inst/extdata/1.spc

bryanhanson commented 2 years ago

Thanks for the file Henning. The version in PR #81 reads this file w/o problems.

henningte commented 2 years ago

To remove pressures on both 'ir' and a potential 'hyperSpec' CRAN update, I have now patched 'ir' on CRAN such that the error disappears. Thanks to the fixes from @bryanhanson, metadata can still be imported with the GitHub version.

So, from my side, there is no urgency any more to update 'hyperSpec' on CRAN, and this is the best solution for all of us, I hope!

GegznaV commented 2 years ago

Seems to be solved in this repo:

library(ir)

x <- 
  hyperSpec::read.spc(
    filename = system.file("extdata/1.spc", package = "ir"),
    log.txt = TRUE,
    log.bin = TRUE,
    log.disk = TRUE,
    keys.hdr2data = TRUE,
    keys.log2data = TRUE,
    no.object = FALSE
  )
#> Warning: Function 'hyperSpec::read.spc' is deprecated. 
#> Please, find alternatives in package 'hySpc.read.spc'
#> https://r-hyperspec.github.io/hySpc.read.spc
x
#> hyperSpec object
#>    1 spectra
#>    45 data columns
#>    1765 data points / spectrum

Created on 2022-07-15 by the reprex package (v2.0.1)

And in hySpc.read.spc https://github.com/r-hyperspec/hySpc.read.spc/pull/22:

library(ir)

y <- 
  hySpc.read.spc::read_spc(
    filename = system.file("extdata/1.spc", package = "ir"),
    log_txt = TRUE,
    log_bin = TRUE,
    log_disk = TRUE,
    keys_hdr2data = TRUE,
    keys_log2data = TRUE,
    no_object = FALSE
  )
y
#> hyperSpec object
#>    1 spectra
#>    45 data columns
#>    1765 data points / spectrum

Created on 2022-07-15 by the reprex package (v2.0.1)