For a file ts.csv with contents
Date,Foo
2000-01-01,1.45
2000-02-01,1.59
the R code
library(zoo)
infile = "ts.csv"
df = read.zoo(infile, header=TRUE, index=1, read=read.csv)
print(df)
cat("\ncolnames =",colnames(df),"\ndone\n")
that reads ts.csv loses the column names, giving output
Attaching package: 'zoo'
The following objects are masked from 'package:base':
as.Date, as.Date.numeric
2000-01-01 2000-02-01
1.45 1.59
colnames =
done
How do I fix this?