Re: [R] How to convert 3-digits hours

2011-07-22 Thread Dieter Menne

Wonjae Lee wrote:
 
 strptime('20110101 0900',%Y%m%d %H%M) 
 [1] 2011-01-01 09:00:00 
 strptime('20110101 900',%Y%m%d %H%M) 
 [1] NA
 
 If I have a 3-digit hour like '900', please show me how to convert it to
 09:00:00.
 

d = c('20110101 900', '20110101 1900')
d1=  gsub( (\\d\\d\\d)$, 0\\1,d)
strptime(d1,%Y%m%d %H%M)

Dieter


--
View this message in context: 
http://r.789695.n4.nabble.com/How-to-convert-3-digits-hours-tp3685436p3686257.html
Sent from the R help mailing list archive at Nabble.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.


[R] How to convert 3-digits hours

2011-07-21 Thread 이원재
Hi, all
Here is what I try to do.
 strptime('20110101 0900',%Y%m%d %H%M)
[1] 2011-01-01 09:00:00
 strptime('20110101 900',%Y%m%d %H%M)
[1] NA
If I have a 3-digit hour like '900', please show me how to convert it to 
9:00:00.
Thank you in advance.
Wonjae

[[alternative HTML version deleted]]

__
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.


[R] How to convert 3-digits hours

2011-07-21 Thread Wonjae Lee
Hi, all

Here is what I tried to do.


 strptime('20110101 0900',%Y%m%d %H%M) 
[1] 2011-01-01 09:00:00 
 strptime('20110101 900',%Y%m%d %H%M) 
[1] NA

If I have a 3-digit hour like '900', please show me how to convert it to
09:00:00.
Thank you in advance.

Wonjae

--
View this message in context: 
http://r.789695.n4.nabble.com/How-to-convert-3-digits-hours-tp3685436p3685436.html
Sent from the R help mailing list archive at Nabble.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.