On 17/01/2013 07:59, e-letter wrote:
Readers,
Responding to an old post
(http://tolstoy.newcastle.edu.au/R/e2/help/07/06/18850.html), and
using the example in the manual:
monthextract<-strptime("20/2/06 11:16:16.683", "%m")
monthextract
[1] NA
Why is the result 'NA' and not '2'?
Because you have not specified a complete date-time, only month = 20
(which is invalid).
The help page actually has
z <- strptime("20/2/06 11:16:16.683", "%d/%m/%y %H:%M:%OS")
I guess you were looking for
strftime(z, "%m")
which gives "02" on my system (it may be platform-specific)
or
z$mon + 1
--
r2151
______________________________________________
[email protected] 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.
--
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://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.