stephen sefick
2009-Aug-13 16:59 UTC
[R] split number in a vector and then make a chron object out of it
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
Henrique Dallazuanna
2009-Aug-13 17:06 UTC
[R] split number in a vector and then make a chron object out of it
Try this: strptime(date.time, "%Y%m%d%H%M%s") On Thu, Aug 13, 2009 at 1:59 PM, stephen sefick <ssefick@gmail.com> wrote:> 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@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. >-- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]
John Kane
2009-Aug-13 17:08 UTC
[R] split number in a vector and then make a chron object out of it
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/
Gabor Grothendieck
2009-Aug-13 17:28 UTC
[R] split number in a vector and then make a chron object out of it
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:> 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. >