Hi! I have an input table with a column "Dates" in the format "month/day/year" (eg. "5/11/1999" and a column "Times" in the format "hours/minutes" (eg. "15:20"). In R I need to convert them into chron objects to extract colums only containing months, days, minutes, .. For the dates it is no problem if I write: dmy.lwc<-chron(dates=lwc.file[,1],format=(dates="m/d/y")) But it does not work the same way for the times if I write: hm.lwc<-chron(times=lwc.file[,2],format=(times="h:m")) Error-Message: Error in convert.times(times., fmt) : format h:m may be incorrect In addition: Warning message: In is.na(out$s) : is.na() applied to non-(list or vector) of type 'NULL' Why should the format "h:m" not be correct? -- View this message in context: http://r.789695.n4.nabble.com/times-tp3016621p3016621.html Sent from the R help mailing list archive at Nabble.com.
I couldn't figure that out, but you can work around it by adding the seconds chron(dates=lwc.file[,1],times=paste(lwc.file[,2],':00',sep='')) Tom 2010/10/28 thoeb <t.hoebinger at gmail.com>:> > Hi! I have an input table with a column "Dates" in the format > "month/day/year" (eg. "5/11/1999" and a column "Times" in the format > "hours/minutes" (eg. "15:20"). In R I need to convert them into chron > objects to extract colums only containing months, days, minutes, .. > > For the dates it is no problem if I write: > dmy.lwc<-chron(dates=lwc.file[,1],format=(dates="m/d/y")) > > But it does not work the same way for the times if I write: > hm.lwc<-chron(times=lwc.file[,2],format=(times="h:m")) > > Error-Message: Error in convert.times(times., fmt) : format h:m may be > incorrect > In addition: Warning message: > In is.na(out$s) : is.na() applied to non-(list or vector) of type 'NULL' > > Why should the format "h:m" not be correct? > -- > View this message in context: http://r.789695.n4.nabble.com/times-tp3016621p3016621.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. >
On Thu, Oct 28, 2010 at 1:06 AM, thoeb <t.hoebinger at gmail.com> wrote:> > Hi! I have an input table with a column "Dates" in the format > "month/day/year" (eg. "5/11/1999" and a column "Times" in the format > "hours/minutes" (eg. "15:20"). In R I need to convert them into chron > objects to extract colums only containing months, days, minutes, .. > > For the dates it is no problem if I write: > dmy.lwc<-chron(dates=lwc.file[,1],format=(dates="m/d/y")) > > But it does not work the same way for the times if I write: > hm.lwc<-chron(times=lwc.file[,2],format=(times="h:m")) > > Error-Message: Error in convert.times(times., fmt) : format h:m may be > incorrect > In addition: Warning message: > In is.na(out$s) : is.na() applied to non-(list or vector) of type 'NULL' > > Why should the format "h:m" not be correct?This has been discussed before. See: http://r.789695.n4.nabble.com/zoo-read-intraday-data-tp3010256p3010312.html -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com