Skip to content
Prev 240529 / 398500 Next

R-help Digest, Vol 93, Issue 5

On Fri, Nov 5, 2010 at 6:00 AM, <r-help-request at r-project.org> wrote:
as.xts.data.frame expects the rownames of the data.frame to contain
the dates/times.  It would probably be easier to use the xts
constructor on your data.frame:

xData <- xts(Data[,-1],Data[,1])  # assumes "date" in first column

You will need to ensure that Data[,"date"] is a time-based class (e.g.
Date, POSIXt).  If it is character, you will need to convert it to a
time-based class before calling xts().

Best,
--
Joshua Ulrich  |  FOSS Trading: www.fosstrading.com