Message-ID: <alpine.LNX.2.20.2109020931350.18288@salmo.appl-ecosys.com>
Date: 2021-09-02T16:32:24Z
From: Rich Shepard
Subject: read.csv() error
The first three commands in the script are:
stage <- read.csv('../data/water/gauge-ht.dat', header = TRUE, sep = ',',
stringsAsFactors = FALSE)
stage$sampdate <- as.Date(stage$sampdate)
stage$ht <- as.numeric(stage$ht, length = 6)
Running the script produces this error:
> source('stage.R')
Error in `$<-.data.frame`(`*tmp*`, ht, value = numeric(0)) :
replacement has 0 rows, data has 486336
Sample lines from the data file:
sampdate,samptime,elev
2007-10-01,01:00,2.80
2007-10-01,01:15,2.71
2007-10-01,01:30,2.63
2007-10-01,01:45,2.53
2007-10-01,02:00,2.45
2007-10-01,02:15,2.36
2007-10-01,02:30,2.27
2007-10-01,02:45,2.17
2007-10-01,03:00,2.07
Maximum value for elev is about 11.00, 5 digits.
I don't understand this error because the equivalent commands for another
data source file completes without error.
What is that error message telling me?
TIA,
Rich