[R] Chron format question h:m not working

arun smartpink111 at yahoo.com
Wed May 1 20:06:12 CEST 2013



HI Stephen,

I am using R 3.0.0.   The responses in an old thread (http://r.789695.n4.nabble.com/times-td3016621.html), suggests  some solutions, but not the one you are looking for. 

A.K.

 sessionInfo()
R version 3.0.0 (2013-04-03)
Platform: x86_64-unknown-linux-gnu (64-bit)
locale:
 [1] LC_CTYPE=en_CA.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_CA.UTF-8        LC_COLLATE=en_CA.UTF-8    
 [5] LC_MONETARY=en_CA.UTF-8    LC_MESSAGES=en_CA.UTF-8   
 [7] LC_PAPER=C                 LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] plyr_1.8        lubridate_1.2.0 chron_2.3-43    stringr_0.6.2  
[5] reshape2_1.2.2 

loaded via a namespace (and not attached):
[1] digest_0.6.3 memoise_0.1  tools_3.0.0 


________________________________
From: stephen sefick <sas0025 at auburn.edu>
To: arun <smartpink111 at yahoo.com> 
Cc: R help <r-help at r-project.org> 
Sent: Wednesday, May 1, 2013 1:55 PM
Subject: Re: [R] Chron format question h:m not working



Thanks for the quick replies.  I have this working with a similar suggestion to what arun suggests.  I am just interested in why the option to use just h:m isn't supported.

#re: Jeff

chron(dates.="2009/05/01", times.="15:00:00", format=c(dates=c("y/m/d"), times="h:m:s"))
chron(dates.="2009/05/01", times.="15:00", format=c(dates=c("y/m/d"), times="h:m"))


same outcome. 


Does updating to R 3.0.0 solve the problem?


Thanks for all of the help.


Stephen





On Wed, May 1, 2013 at 12:36 PM, arun <smartpink111 at yahoo.com> wrote:

HI,
>
>One possible way would be to use paste()
>chron(times.=paste0("15:00",":00"),format=c(times="h:m:s"))
>#[1] 15:00:00
>
>
>#or you could use
>
>library(lubridate)
>hm("15:00")
>#[1] "15H 0M 0S"
>A.K.
>
>
>
>----- Original Message -----
>From: Stephen Sefick <sas0025 at auburn.edu>
>To: "r-help at r-project.org" <r-help at r-project.org>
>Cc:
>Sent: Wednesday, May 1, 2013 12:28 PM
>Subject: [R] Chron format question h:m not working
>
>
>R 2.12.2 on Scientific Linux 6.4
>
>#works
>chron(times.="15:00:00", format=c(times="h:m:s"))
>
>#doesn't work
>chron(times.="15:00", format=c(times="h:m"))
>
>From chron Manual:
>The times format can be any permutation of "h", "m", and "s" separated by any one non-special character. The default is "h:m:s".
>
>what am I missing?
>
>many thanks,
>
>
>-- Stephen Sefick
>**************************************************
>Auburn University
>Biological Sciences
>331 Funchess Hall
>Auburn, Alabama
>36849
>**************************************************
>sas0025 at auburn.edu
>http://www.auburn.edu/~sas0025
>**************************************************
>
>Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods.  We are mammals, and have not exhausted the annoying little problems of being mammals.
>
>                                -K. Mullis
>
>"A big computer, a complex algorithm and a long time does not equal science."
>
>                              -Robert Gentleman
>
>
>______________________________________________
>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.
>
>
>______________________________________________
>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.
>


-- 
Stephen Sefick
____________________________________
| Auburn University                                   |
| Department of Biological Sciences           |
| 331 Funchess Hall                                  |
| Auburn, Alabama                                   |
| 36849                                                    |
|___________________________________|
| sas0025 at auburn.edu                             | 
| http://www.auburn.edu/~sas0025             |
|___________________________________|

Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods.  We are mammals, and have not exhausted the annoying little problems of being mammals.

                                -K. Mullis



More information about the R-help mailing list