Ouch. I should have know all those points Rui: my bad. Casual behaviour while
just rushing up a little example. Good to be reminded.
group_modify() is clearly exactly what I wanted and I will experiment with it
and make sure I understand it properly. I see from the help that it evolves
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
Hello,
You can pass a grouped tibble to a function with grouped_modify but the
function must return a data.frame (or similar).
## this will also do it
#sillyFun <- function(tib){
# tibble(nrow = nrow(tib), ncol = ncol(tib))
#}
sillyFun <- function(tib){
data.frame(nrow = nrow(tib), ncol
3 matches
Mail list logo