[R] Understanding read.csv error message

Rich Shepard r@hep@rd @ending from @ppl-eco@y@@com
Sat Aug 18 00:08:19 CEST 2018

   I have a data file, 'precip_projected.csv,' that starts like this:

Headworks Portland Water,2370575.38427211,199337.634652112,228,2005-01-01,0.59
Headworks Portland Water,2370575.38427211,199337.634652112,228,2005-01-02,0.08
Headworks Portland Water,2370575.38427211,199337.634652112,228,2005-01-03,0.1
Headworks Portland Water,2370575.38427211,199337.634652112,228,2005-01-04,0
Headworks Portland Water,2370575.38427211,199337.634652112,228,2005-01-05,0
Headworks Portland Water,2370575.38427211,199337.634652112,228,2005-01-06,0.02
Headworks Portland Water,2370575.38427211,199337.634652112,228,2005-01-07,0.05
Headworks Portland Water,2370575.38427211,199337.634652112,228,2005-01-08,0.1
Headworks Portland Water,2370575.38427211,199337.634652112,228,2005-01-09,0
Headworks Portland Water,2370575.38427211,199337.634652112,228,2005-01-10,0.02

   There are a bunch of NAs in the data file.

   The command to read it produces an error:

rainfall <- read.csv('../data/precipitation/precip_projected.csv', header = T, sep = ',', as.is = T)

Error in `$<-.data.frame`(`*tmp*`, date, value = numeric(0)) :
   replacement has 0 rows, data has 113569

   Is the error generated by finding a date that looks like the number zero
or by a prcp value of zero?

   BTW, I get the same error if I specify stringsAsFactors = F.



More information about the R-help mailing list