I am new to R, and I am trying to use aggregateto execute some time series built on a data frame, for every object and for every metric in my dataset. This works great, but I believe the result is not in a format that is very easy to use. I would like to be able to convert the results back to the same format as the original frame.
Using an aperture dataset as an example:
iris_species = subset(iris, select=Species)
iris_metrics = subset(iris, select=-Species)
iris_diff = aggregate(iris_metrics, iris_species, diff)
I just use diffit to illustrate that I have a function that forms time series, so I get a time series, possibly of different lengths, as a result, and definitely more than one aggregate value (for example, an average value).
I would like to convert the result, which seems to be a matrix that has a list, a valuable cell for the original “flat” data frame.
I'm most curious about how to manage this with results from aggregate, but I would be fine with the decisions that everyone makes in plyror reshape.
source
share