On Jun 22, 2011, at 2:03 PM, Sarah Goslee wrote:
Hi,
On Wed, Jun 22, 2011 at 11:40 AM, Alexander Shenkin
<ashen...@ufl.edu> wrote:
is.na(strptime("5/2/1992", format="%m/%d/%Y"))
[1] FALSE
is.na(strptime("5/3/1992", format="%m/%d/%Y"))
[1] TRUE
I can't reproduce your problem on R 2.13.0 on linux:
I also cannot reproduce it on a Mac with 2.13.0 beta
> is.na(strptime("5/3/1992", format="%m/%d/%Y"))
[1] FALSE
> sessionInfo()
R version 2.13.0 beta (2011-04-04 r55296)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] grid splines stats graphics grDevices utils datasets
[8] methods base
other attached packages:
[1] reshape2_1.1 gplots_2.8.0 caTools_1.12
[4] bitops_1.0-4.1 gdata_2.8.1 gtools_2.6.2
[7] gamair_0.0-7 mgcv_1.7-6 Matrix_0.999375-50
[10] latticeExtra_0.6-16 RColorBrewer_1.0-2 rms_3.3-0
[13] Hmisc_3.8-3 survival_2.36-9 sos_1.3-0
[16] brew_1.0-6 lattice_0.19-26
loaded via a namespace (and not attached):
[1] cluster_1.13.3 nlme_3.1-101 plyr_1.5.2 stringr_0.4
[5] tools_2.13.0
strptime("5/2/1992", format="%m/%d/%Y")
[1] "1992-05-02"
is.na(strptime("5/2/1992", format="%m/%d/%Y"))
[1] FALSE
strptime("5/3/1992", format="%m/%d/%Y")
[1] "1992-05-03"
is.na(strptime("5/3/1992", format="%m/%d/%Y"))
[1] FALSE
My suspicion is that you imported the data from a spreadsheet and
there's some formatting glitch that's not showing up. If you type the
string "5/3/1992" into the command by hand, do you still get the same
result?
If so, then we need to know your OS and version of R, at least.
Any idea what's going on with this? Running strptime against all
dates
from around 1946, only 5/3/1992 was converted as "NA". Even
stranger,
it still seems to have a value associated with it (even though is.na
thinks it's NA):
strptime("5/3/1992", format="%m/%d/%Y")
[1] "1992-05-03"
This makes no sense to me.
Sarah
--
Sarah Goslee
http://www.functionaldiversity.org
______________________________________________
R-help@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.
David Winsemius, MD
West Hartford, CT
______________________________________________
R-help@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.