I wrote a function to convert data to an xts object many months ago. It worked, and now it no longer works. I do not know how to fix this. I installed the xts package again to no avail. I searched for stackoverflow and searched for it. I would appreciate any help.
Thanks!
Here is the error I get:
Error in .Call("dimnames_zoo", x) : "dimnames_zoo" not resolved from current namespace (xts)
Here is my function:
MakeXts<-function(data){ library(xts) data$Date<-strptime(paste(data$Date,data$Time),"%m/%d/%Y %H:%M:%S") data<-data[,-2] data.xts<-xts(data[,-1],order.by=as.POSIXct(data[,1])) return (data.xts) }
Here is my code:
myData.xts <- MakeXts(myData)
and data:
myData <- structure(list(Date = c("02/12/2015", "02/12/2015", "02/12/2015", "02/12/2015", "02/12/2015", "02/12/2015", "02/12/2015", "02/12/2015", "02/12/2015", "02/12/2015", "02/12/2015", "02/12/2015", "02/12/2015", "02/12/2015", "02/12/2015", "02/12/2015", "02/12/2015", "02/12/2015", "02/12/2015", "02/12/2015", "02/12/2015", "02/12/2015", "02/12/2015", "02/12/2015", "02/12/2015", "02/12/2015", "02/12/2015", "02/12/2015", "02/12/2015", "02/12/2015"), Time = c("16:00:00", "16:00:12", "16:00:46", "16:00:49", "16:01:18", "16:01:25", "16:02:00", "16:02:00", "16:02:00", "16:02:06", "16:03:02", "16:03:02", "16:03:02", "16:03:02", "16:03:02", "16:03:02", "16:03:19", "16:03:22", "16:03:22", "16:03:22", "16:03:22", "16:03:48", "16:04:38", "16:04:56", "16:05:30", "16:06:44", "16:06:58", "16:07:16", "16:08:53", "16:09:06"), Open = c(2082.75, 2082.5, 2082.5, 2082.75, 2082.75, 2082.75, 2082.75, 2082.75, 2082.75, 2082.75, 2083, 2083, 2083, 2083, 2083, 2083, 2082.75, 2082.5, 2082.5, 2082.5, 2082.5, 2082.25, 2082.5, 2082.5, 2082.25, 2082.25, 2082.5, 2082.25, 2082.75, 2082.5), High = c(2082.75, 2082.5, 2082.75, 2082.75, 2082.75, 2082.75, 2082.75, 2082.75, 2083, 2082.75, 2083, 2083, 2083, 2083, 2083, 2083, 2082.75, 2082.5, 2082.5, 2082.5, 2082.5, 2082.75, 2082.75, 2082.5, 2082.5, 2082.75, 2082.75, 2082.75, 2082.75, 2082.75), Low = c(2082.5, 2082.25, 2082.25, 2082.5, 2082.5, 2082.5, 2082.75, 2082.75, 2082.5, 2082.5, 2083, 2082.75, 2082.75, 2083, 2082.75, 2082.75, 2082.5, 2082.5, 2082.5, 2082.5, 2082.25, 2082.25, 2082.5, 2082.25, 2082.25, 2082.25, 2082.5, 2082.25, 2082.5, 2082.5), Close = c(2082.5, 2082.5, 2082.5, 2082.75, 2082.75, 2082.75, 2082.75, 2082.75, 2082.75, 2082.75, 2083, 2082.75, 2082.75, 2083, 2082.75, 2082.75, 2082.5, 2082.5, 2082.5, 2082.5, 2082.25, 2082.5, 2082.5, 2082.25, 2082.5, 2082.5, 2082.5, 2082.75, 2082.5, 2082.5)), .Names = c("Date", "Time", "Open", "High", "Low", "Close"), row.names = c(NA, 30L), class = "data.frame")
Here is my sessionInfo ():
R version 3.1.2 (2014-10-31) Platform: x86_64-w64-mingw32/x64 (64-bit) locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 LC_NUMERIC=C LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] xts_0.9-7 zoo_1.7-11 moments_0.14 data.table_1.9.4 Rcpp_0.11.1 loaded via a namespace (and not attached): [1] chron_2.3-45 grid_3.1.2 lattice_0.20-29 plyr_1.8.1 reshape2_1.4 stringr_0.6.2 tools_3.1.2