[R] Help converting file to XTS

David Winsemius dw|n@em|u@ @end|ng |rom comc@@t@net
Tue Feb 5 18:49:37 CET 2019


On 2/5/19 6:06 AM, Johannes Møllerhagen wrote:
> Hello there! I am a master student working on my master thesis, and I am trying to convert some data to xts so I can apply a highfrequency package to it.
>
> At the moment I am trying to use a POSIXct function. I am quite new at this program and I am having some issue. The file is  attached.
>
>
> The current coding is:
>
>
> dat<-read_csv("TEL5minint.csv")


So dat is now a dataframe

> xts(dat,order.by=as.POSIXct(dat),"%d/%m/%Y %H:%M")


And you are supplying a list (which is what dataframes are) to the 
order.by parameter.

>
>
> And the error is:
>
> Error in as.POSIXct.default(dat) :
>    do not know how to convert 'dat' to class “POSIXct”

The function is telling you that dat is the wrong type of object to be 
converted to the rownames of a matrix (which is what xts objects are.


-- 

David

>
>
> Any help is appreciated!
>
>
> Kind Regards
>
> Johannes
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.



More information about the R-help mailing list