[R] help needed for strptime "000000" !

Dieter Menne dieter.menne at menne-biomed.de
Wed Feb 16 21:22:21 CET 2011



JESSICA wrote:
> 
> 
> I have a text file stored in notepad:
> 
> DATE                         TIME     Q
> 2004-11-01	233311	1
> 2004-11-01	234227	1
> ...
> I  run 
> 
> x<-read.table("C:/R/Sample.txt",header=T)
> then get a table 
> 
> ...
> I am trying to 
> 
> strptime(x$TIME,"%H%M%S")
> 
> and get : 
> 
>  [1] "2011-02-16 23:33:11" "2011-02-16 23:42:27" "2011-02-16 23:43:27"
>  [4] "2011-02-16 23:47:34" NA                    NA                   
>  [7] NA                    NA                    NA                   
> [10] NA                    NA                    NA      
> 
> 
Try (but I a note sure what to do with the DATE column.
Dieter

x<-read.table("datesample.txt",
  colClasses=c("Date","character","integer"), header=T) 
class(x$TIME)= "POSIXct"
strptime(x$TIME,"%H%M%S") 

-- 
View this message in context: http://r.789695.n4.nabble.com/help-needed-for-strptime-000000-tp3309588p3309664.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list