sort_xy(data, x, y, sort = "none", .fun = mean, ...)
Arguments
data
A dataframe (or a tibble) from which variables specified are to
be taken. A matrix or tables will not be accepted.
x
The grouping variable from the dataframe data.
y
The response (a.k.a. outcome or dependent) variable from the
dataframe data.
sort
If "ascending" (default), x-variable factor levels will be
sorted based on increasing values of y-variable. If "descending", the
opposite. If "none", no sorting will happen.
.fun
n summary function. It should take one vector for
fct_reorder, and two vectors for fct_reorder2, and return a single
value.