You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In zoo rollapply can have a list as width argument to specify offsets like:
z <- data.frame(date=as.Date(1:10),
x=1:10)
data.frame(dates=z$date,
rollapply(z$x,by.column=TRUE,
list(-3:-5) ,
mean,
fill=NA))
which calculates the mean of element 3 to 5 position before.
With tq_mutate
z %>%
tq_mutate(
select = x,
mutate_fun = rollapply,
width = list(-3:-5),
FUN = mean)
Error in rollapply.xts(., ...) :
'list' object cannot be coerced to type 'integer'
it seems that the rollapply.xts does not support width = list() while the rollapply.zoo does. Is there an option to use the zoo version of rollaply with tq_mutate or get an offset in some other way?
The text was updated successfully, but these errors were encountered:
In zoo rollapply can have a list as width argument to specify offsets like:
z <- data.frame(date=as.Date(1:10),
x=1:10)
data.frame(dates=z$date,
rollapply(z$x,by.column=TRUE,
list(-3:-5) ,
mean,
fill=NA))
which calculates the mean of element 3 to 5 position before.
With tq_mutate
z %>%
tq_mutate(
select = x,
mutate_fun = rollapply,
width = list(-3:-5),
FUN = mean)
Error in rollapply.xts(., ...) :
'list' object cannot be coerced to type 'integer'
it seems that the rollapply.xts does not support width = list() while the rollapply.zoo does. Is there an option to use the zoo version of rollaply with tq_mutate or get an offset in some other way?
The text was updated successfully, but these errors were encountered: