What is the use of function ~ in generalization?

I am using dplyr's summaryise function and got curious about using ~.

eg,

summarise_(school, .dots = list(~ mean(PE), ~ mean(Math), ~n()))

      

gives me the result of two variables and the number of observations. But why should I use ~ before every function? I don't need this when using the generalize function, so you want to know what it is for!

+3
r


source to share


No one has answered this question yet

Check out similar questions:

936
Grouping functions (e.g. By collection) and families * apply
629
data.table vs dplyr: can something do good and other do bad or bad?
362
Why is '' '' better than 'subset'?
154
How do I use the R ellipsis function when writing my own function?
150
Show% instead of graphs in categorical variable charts
66
Can dplyr sum multiple variables without listing each of them?
7
Packing a data dictionary in R
five
summaryise using different functions for different variables
2
Is there a way to pass dplyr 'do' to a vector function of additional arguments?
0
length () does not work in aggregate function using dot notation



All Articles
Loading...
X
Show
Funny
Dev
Pics