Search
 
SCRIPT & CODE EXAMPLE
 

R

How to use group_by inside a function?

mytable <- function( x, group ) {
  x %>% 
    group_by( .data[[group]] ) %>% 
    summarise( n = n() )
}

group_string <- 'Species'

mytable( iris, group_string )

`summarise()` ungrouping output (override with `.groups` argument)
# A tibble: 3 x 2
  Species        n
  <fct>      <int>
1 setosa        50
2 versicolor    50
3 virginica     50
Comment

PREVIOUS NEXT
Code Example
R :: colorblind-friendly palette in r 
R :: r select columns by name 
R :: how to filter in R whitout lossing NA values 
R :: how to add in dictionary in R 
R :: hypergeometric distribution on r 
R :: créer un dataframe dans r 
R :: r apply functions over list of data frames 
R :: predict y given model in r 
R :: ggplot in R how to show information by hovering 
R :: legend in r 
Rust :: rust allow unused 
Rust :: rust field is never read remove warning 
Rust :: rust sum vector 
Rust :: how to open a file rust 
Rust :: rustlang string 
Rust :: rust error handling 
Rust :: rust iterate vector backwards 
Rust :: count matches with regex 
Rust :: input output rust 
Rust :: convert path to pathbuf 
Rust :: armanriazi•rust•rc•vs•arc 
Rust :: armanriazi•rust•stack•vs•heap 
Rust :: armanriazi•rust•trait•external•implement•coherence•orphan 
Rust :: armanriazi•rust•copy•clone•deeply•shallow 
Lua :: roblox how to make a rainbow part 
Lua :: roblox kill brick script 
Lua :: how do you find a humanoid in roblox 
Lua :: how to check if a sting incules something roblox 
Lua :: roblox random number generator 
Lua :: fivem commands example lua 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =