Open cbeleites opened 4 years ago
@cbeleites this may be related, but I'm currently not understanding why I keep getting an error with scan()
when I try:
> file <- "Witec_TrueMatch.txt"
> read.txt.Witec(file, type = "single", hdr.label = TRUE, encoding = "unknown")
Error in scan(text = tmp, skip = skip, quiet = quiet, encoding = encoding, :
scan() expected 'a real', got 'Version'
> read.txt.Witec(file, type = "map", hdr.label = TRUE, encoding = "unknown")
Error in scan(text = tmp, skip = skip, quiet = quiet, encoding = encoding, :
scan() expected 'a real', got 'Version'
> read.txt.Witec(file)
Error in scan(text = tmp, skip = skip, quiet = quiet, encoding = encoding, :
scan() expected 'a real', got '[WITEC_TRUEMATCH_ASCII_HEADER]'
> read.txt.Witec(file, hdr.label = TRUE)
Error in scan(text = tmp, skip = skip, quiet = quiet, encoding = encoding, :
scan() expected 'a real', got 'Version'
Also, these all run fine:
file <- "Witec_TrueMatch.txt"
microbenchmark(
read.table (file, header = TRUE, dec = ",", sep = "\t"),
readLines(file),
read.ini(file),
readtext(file)
)
@eoduniyi, I don't think these are related: the TrueMatch ASCII file is not suitable for testing scan()
since it has this ini-file format. scan()
can only be used on strings that are basically ASCII printouts of numbers only, no other character strings. So for the TrueMatch files, you need to read e.g. by readLines()
, and then use scan to convert only those lines that are in the [SpectrumData]
sections.
Other ASCII file formats, e.g. the "naked" number tables in the .txt or .dat ones and in the (X).txt and (Y).txt files of the Graph ASCII format are more directly suitable for scan()
.
@eoduniyi, I don't think these are related: the TrueMatch ASCII file is not suitable for testing
scan()
since it has this ini-file format.scan()
can only be used on strings that are basically ASCII printouts of numbers only, no other character strings. So for the TrueMatch files, you need to read e.g. byreadLines()
, and then use scan to convert only those lines that are in the[SpectrumData]
sections.Other ASCII file formats, e.g. the "naked" number tables in the .txt or .dat ones and in the (X).txt and (Y).txt files of the Graph ASCII format are more directly suitable for
scan()
.
Hmm, so is scan()
even something I want to microbench?
@eoduniyi, I don't think these are related: the TrueMatch ASCII file is not suitable for testing
scan()
since it has this ini-file format.scan()
can only be used on strings that are basically ASCII printouts of numbers only, no other character strings. So for the TrueMatch files, you need to read e.g. byreadLines()
, and then use scan to convert only those lines that are in the[SpectrumData]
sections. Other ASCII file formats, e.g. the "naked" number tables in the .txt or .dat ones and in the (X).txt and (Y).txt files of the Graph ASCII format are more directly suitable forscan()
.Hmm, so is
scan()
even something I want to microbench?
And so @GegznaV and @cbeleites the read.txt.Witec()
is not suitable for benchmarking the file io for read_txt_Witec_TrueMatch.R
@cbeleites has this been taken care of?