Skip to content

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

4 messages · stephen sefick, Henrique Dallazuanna, John Kane +1 more

#
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,
#
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:

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

http://www.flickr.com/gift/
#
Try this:

as.chron(date.time, "%Y%m%d%H%M%S")
On Thu, Aug 13, 2009 at 12:59 PM, stephen sefick<ssefick at gmail.com> wrote: