| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/sfl.R |
| 3 |
\name{sfl} |
| 4 |
\alias{sfl} |
| 5 |
\title{Create a skimr function list} |
| 6 |
\usage{ |
| 7 |
sfl(..., skim_type = "") |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{...}{Inherited from dplyr::data_masking() for dplyr version 1 or later |
| 11 |
or dplyr::funs() for older versions of dplyr. |
| 12 |
A list of functions |
| 13 |
specified by: |
| 14 |
\itemize{ |
| 15 |
\item Their name, \code{"mean"} |
| 16 |
\item The function itself, \code{mean} |
| 17 |
\item A call to the function with \code{.} as a dummy argument, |
| 18 |
\code{mean(., na.rm = TRUE)} |
| 19 |
\item An anonymous function in \pkg{purrr} notation, \code{~mean(., na.rm = TRUE)} |
| 20 |
}} |
| 21 |
|
| 22 |
\item{skim_type}{A character scalar. This is used to match locally-provided |
| 23 |
skimmers with defaults. See \code{\link[=get_skimmers]{get_skimmers()}} for more detail.} |
| 24 |
} |
| 25 |
\value{ |
| 26 |
A \code{skimr_function_list}, which contains a list of \code{fun_calls}, |
| 27 |
returned by \code{dplyr::funs()} and a list of skimming functions to drop. |
| 28 |
} |
| 29 |
\description{ |
| 30 |
This constructor is used to create a named list of functions. It also you |
| 31 |
also pass \code{NULL} to identify a skimming function that you wish to remove. |
| 32 |
Only functions that return a single value, working with \code{\link[dplyr:summarise]{dplyr::summarize()}}, |
| 33 |
can be used within \code{sfl}. |
| 34 |
} |
| 35 |
\details{ |
| 36 |
\code{sfl()} will automatically generate callables and names for a variety of |
| 37 |
inputs, including functions, formulas and strings. Nonetheless, we recommend |
| 38 |
providing names when reasonable to get better \code{\link[=skim]{skim()}} output. |
| 39 |
} |
| 40 |
\examples{ |
| 41 |
# sfl's can take a variety of input formats and will generate names |
| 42 |
# if not provided. |
| 43 |
sfl(mad, "var", ~ length(.)^2) |
| 44 |
|
| 45 |
# But these can generate unpredictable names in your output. |
| 46 |
# Better to set your own names. |
| 47 |
sfl(mad = mad, variance = "var", length_sq = ~ length(.)^2) |
| 48 |
|
| 49 |
# sfl's can remove individual skimmers from defaults by passing NULL. |
| 50 |
sfl(hist = NULL) |
| 51 |
|
| 52 |
# When working interactively, you don't need to set a type. |
| 53 |
# But you should when defining new defaults with `get_skimmers()`. |
| 54 |
get_skimmers.my_new_class <- function(column) { |
| 55 |
sfl(n_missing, skim_type = "my_new_class") |
| 56 |
} |
| 57 |
} |
| 58 |
\seealso{ |
| 59 |
\code{\link[dplyr:funs]{dplyr::funs()}}, \code{\link[=skim_with]{skim_with()}} and \code{\link[=get_skimmers]{get_skimmers()}}. |
| 60 |
} |