Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201867

How to implement read.zoo function correctly on my data frame

$
0
0

I have a data frame of apple stock prices YTD as below file name appl.csv

Date Close.Last   Volume   Open   High    Low
1 12/20/2019     279.44 68972090 282.23 282.65 278.56
2 12/19/2019     280.02 24626950 279.50 281.18 278.95
3 12/18/2019     279.74 29024690 279.80 281.90 279.12
4 12/17/2019     280.41 28575800 279.57 281.77 278.80
5 12/16/2019     279.86 32081110 277.00 280.79 276.98
6 12/13/2019     275.15 33432810 271.46 275.30 270.93

I would like to transform the above data into a zoo time series object so that I can use the power of time series analysis. I have tried writing the code as below, but not getting the results. Can anyone help me understand the mistake that I am committing in the code below.

mydata1 <- read.zoo("appl.csv",sep="," ,FUN,header =TRUE,format ="%m-%d-%y")

r gives me the following results

mydata1 <-read.zoo("appl.csv", format = "%m-%d-%y", tz = "", FUN = NULL,
+          regular = FALSE, index.column = 1, drop = TRUE, FUN2 = NULL,
+          split = NULL, aggregate = FALSE, read = read.table,sep=",",header =TRUE)

Error in read.zoo("appl.csv", format = "%m-%d-%y", tz = "", FUN = NULL, : index has 145 bad entries at data rows: 1 2 3 4 5 6 16 17 18 19 20 21 22 23 24 25 26 27 36 37 38 39 40 41 42 43 44 45 46 47 48 49 59 60 61 62 63 64 65 66 67 68 69 70 79 80 81 82 83 84 85 86 87 88 89 90 91 92 101 102 103 104 105 106 107 108 109 110 111 112 113 123 124 125 126 127 128 129 130 131 132 133 134 143 144 145 146 147 148 149 150 151 152 153 154 155 156 165 166 167 ...

Kindly let me know how to use read.zoo function


Viewing all articles
Browse latest Browse all 201867

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>