[R] convert 12 time stamp to 24 hour

PIKAL Petr petr.pikal at precheza.cz
Mon Feb 11 14:46:46 CET 2013


Hi

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of e-letter
> Sent: Monday, February 11, 2013 2:31 PM
> To: r-help at r-project.org
> Subject: Re: [R] convert 12 time stamp to 24 hour
> 
> Readers,
> 
> Have since tried to plot converted 24 hour data:
> 
> testtimedataset
>         V1
> 1 13:01:41
> 2 13:02:10
> 3 13:02:38
> 4 13:03:05
> 5 13:03259
> 
> > testdata<-seq(1:5)
> > plot(testdata~testtimedataset)
> Error in function (formula, data = NULL, subset = NULL, na.action =
> na.fail,  :
>   invalid type (list) for variable 'testtimedataset'
> 
> Was expecting to see a graph with ordinate values 1:5 for the time
> series values on the abscissa. What is the mistake please?

The main mistake is that you did not pay attention to provided documentation especially R-intro.

You try to plot a data frame against a vector testdata. We do not know, what is testtimedataset. You shall provide at least 

str(testtimedataset)
or better
dput(testtimedataset)

Anyway, by

plot(testdata~testtimedataset$V1)

you will get rid of error message but depending on testtimedataset mode you can get different one.

Regards
Petr
> 
> --
> r2151
> 
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list