Skip to content
Prev 384625 / 398525 Next

Can I pass the grouped portions of a dataframe/tibble to a function in dplyr

Hello,

I forgot to say I redid the data set setting the RNG seed first.



set.seed(2020)
n <- 50
x <- 1:n
y <- sample(1:3, n, replace = TRUE)
z <- rnorm(n)
tib <- tibble(x,y,z)


Also, don't do

as_tibble(cbind(...))
as.data.frame(cbind(...))


If one of the variables is of a different class (example, "character") 
all variables are coerced to the least common denominator. It's much 
better to call tibble() or data.frame() directly.

Hope this helps,

Rui Barradas


?s 12:04 de 05/07/2020, Rui Barradas escreveu: