Dimitri Shvorob wrote:
df = structure(list(t = structure(c(1033963406.044, 1033974144.847,
+ 1033988418.836), class = c("POSIXt", "POSIXct"))), .Names = "t", row.names
= c(NA,
+ 3L), class = "data.frame")
df$min = trunc(df$t,units="mins")
does not work, Jeff; you will see that my original post suggests familiarity
with 'trunc' :)
Well, perhaps you should read the error message or the "Value" section of
?trunc.POSIXt, and convert the result to a compact type...
> df$min <- trunc( df$t, units="mins" )
Error in `$<-.data.frame`(`*tmp*`, "min", value = list(sec = 0, min = c(3L, :
replacement has 9 rows, data has 3
> df$min <- as.POSIXct( trunc( df$t, units="mins" ) )
> str(df)
'data.frame': 3 obs. of 2 variables:
$ t : POSIXct, format: "2002-10-06 21:03:26" "2002-10-07 00:02:24" ...
$ min: POSIXct, format: "2002-10-06 21:03:00" "2002-10-07 00:02:00" ...
--
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnew...@dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
______________________________________________
R-help@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.