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

Gabor Grothendieck ggrothendieck at gmail.com
Thu Aug 13 19:28:03 CEST 2009


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




More information about the R-help mailing list