I am trying to convert a csv data.frame into an xts and keep getting the following error:
the file is a csv daily stock data downloaded from Yahoo Finance for "AAPL"
Here is what I did so far:
library(xts)
AAPLcsv <- read.csv(file="~/Desktop/AAPL.csv")
class(AAPLcsv)
#[1] "data.frame"
AAPL <- as.xts(AAPLcsv[, -1], order.by = as.Date(AAPLcsv$Date, "%m/%d/%Y"))
Error in xts(x, order.by = order.by, frequency = frequency, ...) : 'order.by' cannot contain 'NA', 'NaN', or 'Inf'Error in xts(x, order.by = order.by, frequency = frequency, ...) : 'order.by' cannot contain 'NA', 'NaN', or 'Inf'
Help??
as.Date(AAPLcsv$Date, "%m/%d/%Y")
. Please show few of 'Date' values – akrun