posixct

R: Using sapply on vector of POSIXct

I have what may be a very simple question. I want to process a column of POSIXct objects from a dataframe and generate a vector of datetime strings. I tried to use the following sapply call dt <- sapply(df$datetime, function(x) format(x,"%Y-%m-%dT%H:%M:%S")) but to no avail. I keep getting the following error: Error in prettyNu...

[R] How to create multi-panels plots with scatterplot/xyplot and POSIX time objects?

Hi! A newbie question. (ADDED NEW INFO) I have a set of time stamped data that were collected randomly. I like to create a matrix of plots, but I could not create using either scatterplot or xyplot & time objects. my data dataset$Time #POSIX time objects (no set sampling period) #i built POSIX time objects by dataset$T...

vector of POSIXct and sapply

What if you want to apply a function other than format to a list of POSIXct objects? For instance, say I want to take a vector of times, truncate those times to the hour, and apply an arbitrary function to each one of those times. > obs.times=as.POSIXct(c('2010-01-02 12:37:45','2010-01-02 08:45:45','2010-01-09 14:45:53')) > obs.truncat...