4

Is there a way to summarise in dplyr (or with other code) on the same column without having to specify the column each time like this?

 summarise(temp1, earliest=min(ArrDelay), average= mean(ArrDelay), latest=(ArrDelay))
alistaire
  • 42,459
  • 4
  • 77
  • 117
Stephertless
  • 79
  • 1
  • 7
  • 2
    You could use `summarise_each` instead - like `summarise_each(temp1, funs(earliest = min, average = mean, latest = max), ArrDelay)`. – aosmith Apr 14 '16 at 17:44
  • 5
    It might interest you that `summary(iris$Sepal.Length)` is a thing. – Frank Apr 14 '16 at 17:50

1 Answers1

6

You can use summarise_each, which can take a funs argument:

summarise_each(iris, funs(earliest = min, average = mean, latest = max), Sepal.Length)
#
#   earliest  average latest
# 1      4.3 5.843333    7.9
alistaire
  • 42,459
  • 4
  • 77
  • 117