[R] NA instead of time stamp
John Kane
jrkrideau at inbox.com
Tue Jul 17 19:20:42 CEST 2012
I think that you need to supply some data with your question.
Use dput() to output your data or a subset of it and paste the output into the email
See ?dput for more information.
Probably a subset of the data would be sufficient. Something like
dput(head(localRaw, 50) should be fine.
John Kane
Kingston ON Canada
> -----Original Message-----
> From: yolande.tra at gmail.com
> Sent: Tue, 17 Jul 2012 10:48:28 -0400
> To: r-help at r-project.org
> Subject: [R] NA instead of time stamp
>
> I was wondering why I get <NA> instead of the timestamp in the
> following.
> Thanks.
>
>> dataDir <- file.path(wd)
>> localRaw <- read.csv(file.path(dataDir,"LOCAL.csv"),
>> as.is=T,stringsAsFactors
> = FALSE)
>> localRaw[1:2,]
> Year Month Day hour minute second Temp1mab Temp7mab Temp14mab
> Salinity1mab
> 1 2009 10 5 0 0 0 11.288 13.675 13.743
> 33.513
> 2 2009 10 5 0 15 0 11.258 13.684 13.716
> 33.514
> O21mab waveht wavedir waveperiod depth mab along across
> 1 0 54.926 1.600 340 9.09 . NA NA
> 2 0 55.574 1.525 340 9.09 . NA NA
>> DateTime<-with(localRaw,paste(Year,Month,Day,hour,minute))
>> DateTime<-as.POSIXct(DateTime, format="%m/%d/%Y %H:%M")
>> localCond_2009<-xts(localRaw ,order.by=DateTime)
>> localCond_2009[1:2,]
> Year Month Day hour minute second Temp1mab Temp7mab Temp14mab
> <NA> "2009" "10" " 5" " 0" " 0" "0" "11.288" "13.675" "13.743"
> <NA> "2009" "10" " 5" " 0" "15" "0" "11.258" "13.684" "13.716"
> Salinity1mab O21mab waveht wavedir waveperiod depth mab along
> across
> <NA> "33.513" "0" "54.926" "1.600" "340.0" " 9.090" "." NA
> NA
> <NA> "33.514" "0" "55.574" "1.525" "340.0" " 9.090" "." NA
> NA
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
____________________________________________________________
FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family!
Visit http://www.inbox.com/photosharing to find out more!
More information about the R-help
mailing list