Why do I get NA when I do this character conversion to POSIXlt?
library(bReeze)
data(winddata)
tempo <- winddata[,1]
tempo[1:6] # Preview
# [1] "06.05.2009 11:20" "06.05.2009 11:30" "06.05.2009 11:40"
tempo_POSIX <- strptime(tempo, format = "%d.%m.%Y %H:%M")
sum(is.na(tempo_POSIX))
# [1] 6
valores_NA <- which(is.na(tempo_POSIX))
tempo[valores_NA]
# [1] "18.10.2009 00:00" "18.10.2009 00:10" "18.10.2009 00:20"
# [3] "18.10.2009 00:30" "18.10.2009 00:40" "18.10.2009 00:50"
As you can see, the values that were converted to NA behave normally ... they follow the same format as the others.
Oddly enough, the error DOES NOT occur if you pass a value to the tz argument
tempo_POSIX <- strptime(tempo, format = "%d.%m.%Y %H:%M", tz = "GMT")
sum(is.na(tempo_POSIX))
# [1] 0
My system information is:
> sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=Portuguese_Brazil.1252 LC_CTYPE=Portuguese_Brazil.1252
[3] LC_MONETARY=Portuguese_Brazil.1252 LC_NUMERIC=C
[5] LC_TIME=Portuguese_Brazil.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] bReeze_0.4-0
loaded via a namespace (and not attached):
[1] tools_3.0.2