[R] read_csv() error I cannot find
Rich Shepard
r@hep@rd @end|ng |rom @pp|-eco@y@@com
Wed Nov 24 17:37:32 CET 2021
Applying read_csv() on certain data files produce this error:
Error in list(site_nbr = col_character(), sampdate = col_date(), param = col_character(), :
argument 6 is empty
In addition: Warning messages:
1: The following named parsers don't match the column names: param, unit
2: The following named parsers don't match the column names: site_nbr, sampdate, param, quant, unit
3: The following named parsers don't match the column names: site_nbr, sampdate, param, quant, unit
I don't see any argument 6.
My web searches for this error returned nothing relevant.
My syntax for other .csv files with different column titles don't generate
this error.
Here are the head of one data file and the read_csv() command to import it:
$ head upriv-chla.csv
site_nbr,sampdate,param,quant,unit
10350,1989-07-18,chl-a,2.50,ug/l
10350,1989-08-16,chl-a,2.70,ug/l
10350,1989-09-20,chl-a,5.20,ug/l
10350,1990-05-30,chl-a,0.70,ug/l
10350,1990-06-26,chl-a,4.50,ug/l
10350,1990-07-17,chl-a,2.60,ug/l
10350,1990-08-20,chl-a,3.40,ug/l
10350,1990-09-18,chl-a,3.40,ug/l
10350,1991-07-08,chl-a,9.20,ug/l
10350,1991-10-07,chl-a,4.70,ug/l
upriv_chla <- read_csv("../data/geochem/upriv-chla.csv", col_names = TRUE,
col_types = list (
site_nbr = col_character(),
sampdate = col_date(format = "D"),
param = col_character(),
quant = col_double(),
unit = col_character()
))
Note: I added the date format after seeing the error but that did not fix
the problem.
Running 'grep -axv '.*' upriv-chla.csv' to see if there are non-ASCII
characters in the file shows there aren't any.
I've no idea how to identify the source of this error beyond what I've done.
Suggestions needed.
Rich
More information about the R-help
mailing list