Consider the following code:
请考虑以下代码:
foo <- function() {
if (runif(1) < 0.5) {
return(data.frame(result="low"))
} else {
return(data.frame(result="high"))
}
}
df = data.frame(val=c(1,2,3,4,5,6))
df %>% group_by(val) %>% do(foo())
foo <