[R] Is 'temp' a reserved/key word in R?

Micha Silver t@v|b@r @end|ng |rom gm@||@com
Tue Nov 30 15:46:14 CET 2021


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 using 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



More information about the R-help mailing list