Dear James,
Try this:
as.Date('20081121',"%Y%m%d")
[1] "2008-11-21"
HTH,
Jorge
On Thu, Nov 20, 2008 at 9:59 PM, Smith, James (EWLS) <
james.smith2@riotinto.com> wrote:
> G'day all,
>
>
>
> I have many, very long time series' that come in to R in txt format and
> so the date column is structured:
>
> 20081121
>
> I would like them all to look like 2008-11-21 but cannot find any way to
> add these characters to all dates in one column in R.
>
> I have way too many files to do it manually in a spreadsheet program
> like excel.
>
> Any ideas please ?
>
>
>
> thanks
>
>
>
> James
>
>
>
>
>
>
>
> Dr James Smith
> Senior Ecologist, EWL Sciences
> Ph: 08 8942 5759 Fax: (08) 8942 5790
> Email: james.smith@ewlsciences.com.au
> <mailto:james.smith@ewlsciences.com.au>
>
> This email is confidential and may also be privileged. If you are not the
> intended recipient, please notify us immediately and delete this message
> from your system without first printing or copying it. Any personal data in
> this email (including any attachments) must be handled in accordance with
> the Rio Tinto Group Data Protection Policy and all applicable data
> protection laws.
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>
[[alternative HTML version deleted]]