Re: [R] sum of two POSIXct objects: date and hour

2014-04-29 Thread Massimo Bressan
yes jim, that's pretty close to what I managed to do after your first hint ### mys.100<-sprintf(".%02d", df$s.100) myhour<-strftime(df$hour, format = "%H:%M:%S") myday<-strftime(df$date, format = "%Y-%m-%d") my.new.datetime<-as.POSIXct(paste0(paste(myday, myhour),mys.100)) op <- options(digits.s

Re: [R] sum of two POSIXct objects: date and hour

2014-04-29 Thread jim holtman
Here is how I would do the conversion. I start off by setting my timezone to GMT. # > df<-structure(list(date = structure(c(1395874800, 1395874800, + 1395874800, + 1395874800, 1395874800), class = c("POSIXct", "POSIXt"), tzone = ""), + hour = structure(c(-220912

Re: [R] sum of two POSIXct objects: date and hour

2014-04-29 Thread mbressan
hi, thanks for your reply the first record for my date is 2014-03-27 and for my hour is 1899-12-30 12:03:16 I got to this point by importing some data via RODBC from an access database Now, I would like to get a single column with the date and the time that for the first record should be equal t

Re: [R] sum of two POSIXct objects: date and hour

2014-04-29 Thread jim holtman
When I read in your data, I get the following since I am in the EDT time zone: > df<-structure(list(date = structure(c(1395874800, 1395874800, 1395874800, + 1395874800, 1395874800), class = c("POSIXct", "POSIXt"), tzone = ""), + hour = structure(c(-2209121804, -2209121567, -2209121005, +

[R] sum of two POSIXct objects: date and hour

2014-04-29 Thread Massimo Bressan
I have this dataframe: df<-structure(list(date = structure(c(1395874800, 1395874800, 1395874800, 1395874800, 1395874800), class = c("POSIXct", "POSIXt"), tzone = ""), hour = structure(c(-2209121804, -2209121567, -2209121005, -2209118616, -2209116160), class = c("POSIXct", "POSIXt"), tzon