When reading files with headers, such as this one on the ITRDB, there may be a comma (",") in the site name that read.rwl() will incorrectly assume is part of the file formatting, and assume it's a .csv file.
> read.rwl("https://www.ncei.noaa.gov/pub/data/paleo/treering/measurements/northamerica/usa/nm589.rwl")
Attempting to automatically detect format.
Detected a csv file.
Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec, :
line 1 did not have 2 elements
if(grepl(",", l1)){
cat(gettext("Detected a csv file.\n",
domain="R-dplR"))
csv2rwl(fname, ...)
}
where l1 could be replaced to look for a comma within the text block obtained for the tridas format (line 44),
if(any(grepl(",", more.lines))){
cat(gettext("Detected a csv file.\n",
domain="R-dplR"))
csv2rwl(fname, ...)
}
resulting in this ITRDB file being correctly identified as Tucson format:
read.rwl("https://www.ncei.noaa.gov/pub/data/paleo/treering/measurements/northamerica/usa/nm589.rwl")
Attempting to automatically detect format.
Assuming a Tucson format file.
There appears to be a header in the rwl file
[1] 0
There are 56 series
When reading files with headers, such as this one on the ITRDB, there may be a comma (",") in the site name that
read.rwl()
will incorrectly assume is part of the file formatting, and assume it's a .csv file.The issue is located on line 51 of read.rwl():
where
l1
could be replaced to look for a comma within the text block obtained for the tridas format (line 44),resulting in this ITRDB file being correctly identified as Tucson format: