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

John Kane jrkr|de@u @end|ng |rom gm@||@com
Thu Aug 3 17:12:39 CEST 2023


One reason seems to be you are saying sep = "," and there is no "," in the
file.
Also you only have 3 columns of data but 4 variable names.

On Thu, 3 Aug 2023 at 10:53, Christofer Bogaso <bogaso.christofer using gmail.com>
wrote:

> 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
>
> ______________________________________________
> 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.
>


-- 
John Kane
Kingston ON Canada

	[[alternative HTML version deleted]]



More information about the R-help mailing list