View source: R/quick-summary.R
| describe | R Documentation |
Displays a compact description of variable names, types, missing values, distinct values, labels, and factor levels. This is intended for quickly checking the structure of active data without opening an HTML file.
describe(..., data = NULL, show = TRUE, console = FALSE)
... |
Optional variables. If omitted, all variables are described. An explicit data frame may be supplied as the first unnamed argument. |
data |
Optional data frame. When omitted, active data is used. |
show |
Logical; open the formatted result in the Viewer. Default |
console |
Logical; also print the traditional result in the Console. Default |
Invisibly returns a data frame.
d <- data.frame(
id = 1:4,
sex = factor(c("Female", "Male", "Female", "Male")),
age = c(25, 40, NA, 52)
)
attr(d$sex, "label") <- "Sex"
usedf(d, quiet = TRUE)
describe()
describe(sex, age)
usedf(clear = TRUE, quiet = TRUE)
# Extended usage examples
patient <- data.frame(
id = 1:4,
sex = factor(c("Female", "Male", "Female", "Male")),
age = c(25, 40, NA, 52),
outcome = c(FALSE, TRUE, FALSE, TRUE)
)
attr(patient$sex, "label") <- "Sex"
usedf(patient)
# Describe every variable or selected variables
describe()
describe(sex)
describe(sex, age, outcome)
# Explicit data and invisible returned metadata
describe(patient)
info <- describe(age, sex, data = patient, show = FALSE)
info
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.