A short data file:
site_nbr,sampdate.param,quant,unit
31731,2005-07-12,temp,19.7,oC
31731,2007-03-28,temp,9,oC
31731,2007-06-27,temp,18.3,oC
31731,2007-09-26,temp,15.8,oC
31731,2008-01-17,temp,5.4,oC
31731,2008-03-27,temp,7.4,oC
31731,2010-04-05,temp,8.1,oC
31731,2010-07-26,temp,20.5,oC
31731,2010-10-18,temp,12.5,oC
31731,2011-01-10,temp,5.4,oC
The import function:
sal_temp <- read_csv("../data/geochem/sal-temp.csv", col_names =
TRUE,
col_types = list (
site_nbr = col_character(),
sampdate = col_date(),
param = col_character(),
quant = col_double(),
unit = col_character()
))
The response from R:
source('../scripts/test.r')
Warning message:
The following named parsers don't match the column names: sampdate, param
I searched the web to see if 'temp' is causing the problem and
didn't find
an answer; my search term might have been flawed.
If that string is a problem please suggest an alternative.
TIA,
Rich
It seems like the headers are misnamed, that should be a comma between sampdate and param, not a period On Tue, Nov 30, 2021, 09:35 Rich Shepard <rshepard at appl-ecosys.com> wrote:> A short data file: > site_nbr,sampdate.param,quant,unit > 31731,2005-07-12,temp,19.7,oC > 31731,2007-03-28,temp,9,oC > 31731,2007-06-27,temp,18.3,oC > 31731,2007-09-26,temp,15.8,oC > 31731,2008-01-17,temp,5.4,oC > 31731,2008-03-27,temp,7.4,oC > 31731,2010-04-05,temp,8.1,oC > 31731,2010-07-26,temp,20.5,oC > 31731,2010-10-18,temp,12.5,oC > 31731,2011-01-10,temp,5.4,oC > > The import function: > sal_temp <- read_csv("../data/geochem/sal-temp.csv", col_names = TRUE, > col_types = list ( > site_nbr = col_character(), > sampdate = col_date(), > param = col_character(), > quant = col_double(), > unit = col_character() > )) > > The response from R: > source('../scripts/test.r') > Warning message: > The following named parsers don't match the column names: sampdate, param > > I searched the web to see if 'temp' is causing the problem and didn't find > an answer; my search term might have been flawed. > > If that string is a problem please suggest an alternative. > > TIA, > > Rich > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]
In header the row of the sample data file, the column names, "sampdate" and "param" are separated by a period, not comma. That would cause the error you're getting. On 30/11/2021 16:34, Rich Shepard wrote:> A short data file: > site_nbr,sampdate.param,quant,unit?? <<<==> 31731,2005-07-12,temp,19.7,oC > 31731,2007-03-28,temp,9,oC > 31731,2007-06-27,temp,18.3,oC > 31731,2007-09-26,temp,15.8,oC > 31731,2008-01-17,temp,5.4,oC > 31731,2008-03-27,temp,7.4,oC > 31731,2010-04-05,temp,8.1,oC > 31731,2010-07-26,temp,20.5,oC > 31731,2010-10-18,temp,12.5,oC > 31731,2011-01-10,temp,5.4,oC > > The import function: > sal_temp <- read_csv("../data/geochem/sal-temp.csv", col_names = TRUE, > ???????????????????? col_types = list ( > ???????????????????????? site_nbr = col_character(), > ???????????????????????? sampdate = col_date(), > ???????????????????????? param = col_character(), > ???????????????????????? quant = col_double(), > ???????????????????????? unit = col_character() > ???????????????????? )) > > The response from R: > source('../scripts/test.r') > Warning message: > The following named parsers don't match the column names: sampdate, param > > I searched the web to see if 'temp' is causing the problem and didn't > find > an answer; my search term might have been flawed. > > If that string is a problem please suggest an alternative. > > TIA, > > Rich > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.-- Micha Silver Ben Gurion Univ. Sde Boker, Remote Sensing Lab cell: +972-523-665918