[R] Converting the data in year month day hour and minutes to date

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Tue Feb 19 19:45:01 CET 2013


It is possible to squeeze a square peg into a round hole, but often you will not be satisfied with the result. Date is for... surprise, dates. You may want to use the chron package or the POSIXct type. The R Journal of June 2004 (Volume 4/1) "R Help Desk" column is recommended reading.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

Janesh Devkota <janesh.devkota at gmail.com> wrote:

>Hi , 
>
> 
>
>I am trying to convert the date as factor to date using "as.date"
>function
>in R. I have the date in the following format
>
>2008-01-01 02:30
>
> 
>
>I tried to use the following command : 
>
>as.Date(mydata$Date, format="%y-%m-%d  ")
>
> 
>
>Can somebody help me with this ? I was able to convert the format with
>no
>hour but getting difficulty with hour included. 
>
> 
>
>Thank you. 
>
> 
>
>Janesh
>
>
>	[[alternative HTML version deleted]]
>
>______________________________________________
>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