1

I know that it represents a linear model relationship case because the docs, but when is this way? (see example below inside the sumarise_all function) how could I interpret it?

library(tidyverse)
# Example data
df <- tibble(col1 = c(1, 2, 3, NA), 
             col2 = c(NA, NA, "a", "b"))

df %>% summarise_all(~ sum(is.na(.)))
Gregor Thomas
  • 136,190
  • 20
  • 167
  • 294
StivJ
  • 55
  • 5
  • 3
    It is anonymous function ie. function created on the fly `function(x) sum(is.na(x))` i.e. a shorter, compact way to `function(x)` – akrun Dec 04 '19 at 14:50
  • 1
    literal meaning can be 'as a function of' – Sotos Dec 04 '19 at 14:51
  • 1
    See `?summarize_all` for a little explanation. The `.funs` argument documentation describes "A function fun, a quosure style lambda `~ fun(.)` or a list of either form." Scrolling down, there is a little more explanation in the examples. – Gregor Thomas Dec 04 '19 at 14:52
  • 2
    See also 9.2.2 in [Advanced R](https://adv-r.hadley.nz/functionals.html) for more indepth explanation.. – MSR Dec 04 '19 at 14:52
  • @MSR thanks a lot!! – StivJ Dec 04 '19 at 14:55

0 Answers0