[R] column of dates into time series

Linlin Yan yanlinlin82 at gmail.com
Sun Nov 29 13:52:58 CET 2009


There is no year() function. Maybe you can try format() instead.

On Sun, Nov 29, 2009 at 8:44 PM, DispersionMap <frenchcr at btinternet.com> wrote:
>
> i have a column of dates in this format:
>
> data[,"Raised.Date"] <- as.Date(data[,"Raised.Date"], "%d/%m/%Y");
> data[1:10,"Raised.Date"]
> [1] "2006-07-07" "2006-07-07" "2006-04-03" "2006-04-03" "2006-04-03"
> "2006-04-03" "2006-04-03" "2006-04-03" "2006-04-03" "2006-04-03"
>
> I can turn them into months like this...
>
> Month<-months(data[,"Raised.Date"])
> Month[1:10]
> [1] "July"  "July"  "April" "April" "April" "April" "April" "April" "April"
> "April"
>
>
> But i also want to turn them into years (and also weeks later on), so tried
> this...
>
> Year<-year(data[,"Raised.Date"])
> Error: could not find function "year"
>
>
> thanks.
> --
> View this message in context: http://n4.nabble.com/column-of-dates-into-time-series-tp930699p930699.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.
>




More information about the R-help mailing list