| skim {scope} | R Documentation |
Apply a function to values in the specified data frame column, across each group of rows specified in the scope object.
skim(x, this, FUN = "max", scope = NULL, ...)
x |
A data frame. |
this |
A column name in x, the main argument to FUN. |
FUN |
An aggregate function. |
scope |
A scope object, e.g. created by scope(). |
... |
Extra arguments to pass to FUN. |
The default scope is all rows. The default function is max(...).
Remember that skim() returns a data vector, not a scope object. For
functions that return one of their arguments (perhaps max and min but perhaps
not mean) the result of skim() can be passed back to scope() to ‘probe’ for
the row from which the value originated. There is a danger that more or fewer
than one row will be detected, so check with score().
A vector of same length as this giving aggregated values.
data(Theoph) #What is the maximum concentration for each subject? S <- scope(Theoph,'Subject') m <- skim(Theoph,'conc',scope=S)