I have a column of dates in this format.. 19900501 I want to change 19900501 into 1990 05 01 then append a new column on the end (right hand side of spreadsheet) :confused: -- View this message in context: http://old.nabble.com/19900501-into-1990-05-01-tp26217515p26217515.html Sent from the R help mailing list archive at Nabble.com.
Something like:
format(as.Date("20090501",format="%Y%m%d"), "%Y %m
%d")
r
-------------------------------------------------
Remko Duursma
Post-Doctoral Fellow
Centre for Plants and the Environment
University of Western Sydney
Hawkesbury Campus
Richmond NSW 2753
Dept of Biological Science
Macquarie University
North Ryde NSW 2109
Australia
Mobile: +61 (0)422 096908
www.remkoduursma.com
On Fri, Nov 6, 2009 at 6:04 AM, frenchcr <frenchcr at btinternet.com>
wrote:>
> I have a column of dates in this format.. 19900501
>
> I want to change
> 19900501 into 1990 05 01
> then append a new column on the end (right hand side of spreadsheet)
>
> :confused:
> --
> View this message in context:
http://old.nabble.com/19900501-into-1990-05-01-tp26217515p26217515.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>
If you just want it to remain as character data:> sub("(....)(..)(..)", "\\1 \\2 \\3", "19000501")[1] "1900 05 01">On Thu, Nov 5, 2009 at 2:04 PM, frenchcr <frenchcr at btinternet.com> wrote:> > I have a column of dates in this format.. 19900501 > > I want to change > 19900501 into 1990 05 01 > then append a new column on the end (right hand side of spreadsheet) > > :confused: > -- > View this message in context: http://old.nabble.com/19900501-into-1990-05-01-tp26217515p26217515.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve?