[R] split number in a vector and then make a chron object out of it

John Kane jrkrideau at yahoo.ca
Thu Aug 13 19:08:44 CEST 2009


I'm not sure that I understand your problem but if you want the vector in character rather than numeric try: 

library(Hmisc)
library(Hmisc)
time.date<- Cs(19851001001500, 19851001003000, 19851001004500, 19851001010000,
19851001011500, 19851001013000, 19851001014500, 19851001020000,
19851001021500, 19851001023000, 19851001024500, 19851001030000,
19851001031500, 19851001033000, 19851001034500, 19851001040000,
19851001041500, 19851001043000, 19851001044500, 19851001050000,
19851001051500, 19851001053000, 19851001054500, 19851001060000,
19851001061500, 19851001063000, 19851001064500, 19851001070000,
19851001071500, 19851001073000)


--- On Thu, 8/13/09, stephen sefick <ssefick at gmail.com> wrote:

> From: stephen sefick <ssefick at gmail.com>
> Subject: [R] split number in a vector and then make a chron object out of it
> To: r-help at r-project.org
> Received: Thursday, August 13, 2009, 12:59 PM
> These are date and times in the
> format YYYYMMDDhhmmss.  I would like
> to take this column and make a chron object form
> them.  I have tried a
> couple of the split family of functions but they need
> character input
> 
> here is the data:
> 
> date.time <- c(19851001001500, 19851001003000,
> 19851001004500, 19851001010000,
> 19851001011500, 19851001013000, 19851001014500,
> 19851001020000,
> 19851001021500, 19851001023000, 19851001024500,
> 19851001030000,
> 19851001031500, 19851001033000, 19851001034500,
> 19851001040000,
> 19851001041500, 19851001043000, 19851001044500,
> 19851001050000,
> 19851001051500, 19851001053000, 19851001054500,
> 19851001060000,
> 19851001061500, 19851001063000, 19851001064500,
> 19851001070000,
> 19851001071500, 19851001073000)
> 
> 
> thanks for the help,
> -- 
> Stephen Sefick
> 
> 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
> 
> ______________________________________________
> 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.
> 


      __________________________________________________________________
Looking for the perfect gift? Give the gift of Flickr! 

http://www.flickr.com/gift/




More information about the R-help mailing list