Chris
- Original Message -
> From: "Rui Barradas"
> To: "Chris Evans" , "R-help"
> Sent: Sunday, 5 July, 2020 13:16:19
> Subject: Re: [R] Can I pass the grouped portions of a dataframe/tibble to a
> function in dplyr
> Hello,
>
> I fo
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 (ex
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 =
Apologies if this is a stupid question but searching keeps getting things I
know and don't need.
What I want to do is to use the group-by() power of dplyr to run functions that
expect a dataframe/tibble per group but I can't see how do it. Here is a
reproducible example.
### create trivial t
4 matches
Mail list logo