[R] extract year or month from date

Gabor Grothendieck ggrothendieck at gmail.com
Tue Oct 9 16:06:43 CEST 2007

Read the help desk article on dates in R News 4/1.

On 10/9/07, Mary Royerr <mroyerr at gmail.com> wrote:
> Hi,
> I am having trouble extracting just the year or the month or the day from a
> date such as 5/7/2007 which is May 7th 2007. Is there any particular
> function to extract just the year from this format?
> When I am reading this data from a text file it is reading it correctly in
> the same format but does not acknowlede it as date but as a factor. If I try
> as.date(5/7/2007) then it is converting it to 1Jan1960. Weird it is. Any
> help on that front?
> Any help is greatly appreciated.
>        [[alternative HTML version deleted]]
> ______________________________________________
> 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