R rolling function error "Error: Unsupported use of matrix or array for column indexing" -


i make rolling mean time window (e.g., 3 days) rather number of observations (e.g., when these unequally spaced).

i have column ("check") dates in format "yyyy-mm-dd h:m:s" unequally spaced.

check 2012-01-01 21:05:00 2012-01-01 21:09:00 2012-01-01 22:57:00 2012-01-01 23:21:00 2012-01-02 04:26:00 2012-01-02 04:43:00 2012-01-02 05:06:00 2012-01-02 05:28:00 

this column has 146,481 rows. i'm trying use following code suggested in section

check <- unique(check); view(check); z <- zoo(seq_along(check), check); 

but error message "error: unsupported use of matrix or array column indexing"

the sequence of entire code follows

check <- unique(check); view(check); z <- zoo(seq_along(check), check); g <- zoo(, seq(start(z), end(z), "min")) zm <- merge(z, g) ## - 3-day rolling mean rollapply(zm, 1440, mean, na.rm = true, fill = na) 

the idea order records , classify them minutes replacing "na" non-informed intervals , allow mean calculation of days or more.

if me suggestions.

the result of dput(check) is:

dput(check);

structure(list(event_time = structure(c(1325451900, 1325452140,  1325458620, 1325460060, 1325478360, 1325479380, 1325480760, 1325482080,  1325482920, 1325483580), class = c("posixct", "posixt"), tzone = "utc")), .names = "event_time", row.names = c(na,  -10l), class = c("tbl_df", "tbl", "data.frame")) 

this after reducing data 10 rows.


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -