[R] transforming year.weeknumber into dates
jim holtman
jholtman at gmail.com
Fri Jul 15 21:26:47 CEST 2011
try this:
> x <- c('2009.12', '2009.30')
> as.Date(paste(x, '1'), format = "%Y.%W %w")
[1] "2009-03-23" "2009-07-27"
>
>
On Fri, Jul 15, 2011 at 1:54 PM, Dimitri Liakhovitski
<dimitri.liakhovitski at gmail.com> wrote:
> Hello!
>
> I know how to transform dates into year.weeknumber format using zoo:
>
> library(zoo)
> as.numeric(format(as.Date("2010-10-02"), "%Y.%W"))
>
> But is there a straightforward way to do the opposite - to transform
> character strings like "2009.12" or "2009.30" back into dates
> (assuming that weeks start on Monday)?
> Thanks a lot!
>
>
> --
> Dimitri Liakhovitski
>
> ______________________________________________
> 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
Data Munger Guru
What is the problem that you are trying to solve?
More information about the R-help
mailing list