[R] time series from timed data

Sam Steingold sds at gnu.org
Tue Mar 22 23:49:22 CET 2011


Hi,
thanks for your reply.

> * Gabor Grothendieck <ttebguraqvrpx at tznvy.pbz> [2011-03-18 17:51:03 -0400]:
> On Fri, Mar 18, 2011 at 2:19 PM, Sam Steingold <sds at gnu.org> wrote:
>
> 2. An alternative that won't generate a warning message but involves a
> double read is:
>
> library(zoo)
> toPOSIXct <- function(x) as.POSIXct(trunc(as.POSIXct(x), "sec"))
> z <- read.zoo(textConnection(Lines), FUN = toPOSIXct, sep =
> ",",	aggregate = mean)
> zl <- read.zoo(textConnection(Lines), FUN = toPOSIXct, sep = ",",
> aggregate = length)
> cbind(z, count = zl[,1])
>
> In all cases replace textConnection(Lines) with the "myfile.csv" or whatever.

is it possible to avoid both double read and warning?
I tried to pass a data frame to read.zoo and got

Error in function (x)  : 
  unused argument(s) (sec = c(24.7736890316010, 27.7369959354401, 27.7369959354401, 28.8604519367218, 29.1779129505157, 30.0554060935974, 30.30619597435, 30.3425068855286, 30.5043799877167, 30.5294759273529, 31.567528963089, 31.5929388999939, 31.6186139583588, 31.670196056366, 31.7729399204254, 31.873172044754, 31.9950220584869, 32.4294190406799, 32.5335929393768, 32.8650600910187, 32.8651750087738, 32.8945369720459, 32.8971579074860, 32.8987069129944, 33.6954081058502, 33.7132570743561, 33.9529790878296, 33.9542989730835, 

  apparently in the call to toPOSIXct

-- 
Sam Steingold (http://sds.podval.org/) on CentOS release 5.5 (Final) X
http://www.PetitionOnline.com/tap12009/ http://truepeace.org
http://memri.org http://mideasttruth.com http://pmw.org.il
Any programming language is at its best before it is implemented and used.



More information about the R-help mailing list