On Mon, 15 Dec 2003, Wayne Jones wrote:

> 
> Hello there fellow R-users, 
> 
> I have received some data which comes in the following format: 
> 
> example1<-"200301"
> 
> The first 4 digits correspond to the year and the remaining 2 digits
> correspond to the week of the year. 
> I have tried to convert this to a date by using strptime as follows:
> 
> strptime(example1,format="%Y%U")
> 
> where U (looking up strptime) is the week of the year but it always returns
> NA. 

That is not a complete date!   Which day of the week is it?

> example1<-"200301"
> strptime(paste(example1, "1", format="%Y%U %d")

will work, and you need to do something like that to resolve the 
ambiguity.

Brian

-- 
Brian D. Ripley,                  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to