On Fri, Nov 5, 2010 at 6:00 AM, <r-help-requ...@r-project.org> wrote: > Send R-help mailing list submissions to > r-h...@r-project.org > > To subscribe or unsubscribe via the World Wide Web, visit > https://stat.ethz.ch/mailman/listinfo/r-help > or, via email, send a message with subject or body 'help' to > r-help-requ...@r-project.org > > You can reach the person managing the list at > r-help-ow...@r-project.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of R-help digest..." > > > Message: 121 > Date: Fri, 5 Nov 2010 09:28:51 +0100 > From: spela podgorsek <spelc...@gmail.com> > To: r-help@r-project.org > Subject: [R] as.xts > Message-ID: > <aanlktinu6a-y3o9jw+jhyprad+1tsrhzunnowwu29...@mail.gmail.com> > Content-Type: text/plain; charset=UTF-8 > > hey > > I am trying to turn a dataframe into xts with the function: > as.xts, > but it returns the error: > > Error in as.POSIXlt.character(x, tz, ...) : > character string is not in a standard unambiguous format > > could someone give me some pointers please > > the data is coming from a spreadsheet via the excel, and has 5 columns > of data (date (with the date and time), open, high, low, close) (excel > format) > > ela >
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 > > _______________________________________________ > R-help@r-project.org mailing list > 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. > > End of R-help Digest, Vol 93, Issue 5 > ************************************* > ______________________________________________ R-help@r-project.org mailing list 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.