[R] Could not read time series data using read.zoo()

Christofer Bogaso bog@@o@chr|@to|er @end|ng |rom gm@||@com
Thu Aug 3 16:53:07 CEST 2023


Hi,

I have a CSV which contains data like below (only first few rows),

Date Adj Close lret
02-01-1997 737.01
03-01-1997 748.03 1.48416235
06-01-1997 747.65 -0.050813009
07-01-1997 753.23 0.743567202
08-01-1997 748.41 -0.64196699
09-01-1997 754.85 0.856809786
10-01-1997 759.5 0.614126802

However when I try to read this data using below code I get error,

read.zoo("1.csv", sep = ',', format = '%d-%m-%Y')

Error reads as,

index has 4500 bad entries at data rows: 1 2 3 4 5 6 7 8 9.....

Could you please help to understand why I am getting this error?

> sessionInfo()

R version 4.2.2 (2022-10-31)

Platform: x86_64-apple-darwin17.0 (64-bit)

Running under: macOS Big Sur ... 10.16


Matrix products: default

BLAS:   /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRblas.0.dylib

LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib


locale:

[1] C/UTF-8/C/C/C/C


attached base packages:

[1] stats     graphics  grDevices utils     datasets  methods   base


other attached packages:

[1] zoo_1.8-12


loaded via a namespace (and not attached):

[1] compiler_4.2.2  tools_4.2.2     grid_4.2.2      lattice_0.20-45



More information about the R-help mailing list