Displaying 2 results from an estimated 2 matches for "tsdaply".
2011 Apr 04
3
How to speed up grouping time series, help please
...nv)
else # create xx in env
assign("xx",
timeSeries(x$VALUE, x$DATE, format = '%Y-%m-%d %H:%M:%S',
zone = 'GMT', units = as.character(x$ID[1])),
envir = env)
return(TRUE)
}
}
# use package plyr, faster than 'by' function
tsDaply <- function(...)
{
library(plyr)
e1 <- new.env(parent = baseenv()) #create a new env
res <- daply(X, "ID", buildTimeSeriesFromDataFrame,
env = e1)
return(get("xx", e1)) # return xx from env
}
##replicate 100 times
#Time03 <- replicate(100,
# system.ti...
2011 Mar 11
1
dataframe to a timeseries object
I?m wondering which is the most efficient (time, than memory usage) way to obtain a multivariate time series object from a data frame (the easiest data structure to get data from a database trough RODBC).
I have a starting point using timeSeries or xts library (these libraries can handle time zones), below you can find code to test.
Merging parallelization (cbind) is something I?m thinking at