if (FALSE) {
library(dplyr)
data <- data.frame(
index = c(2, 3, 3, 4, 5, 8, 10, 10, 13, 15),
a = rep(c("a", "b"), each = 5),
b = 1:10
)
data %>%
group_by(a) %>%
run_by(idx = "index", k = 5) %>%
mutate(
c = runner(
x = .,
f = function(x) {
paste(x$b, collapse = ">")
}
),
d = runner(
x = .,
f = function(x) {
sum(x$b)
}
)
)
}
Run the code above in your browser using DataLab