describe: Describe variables in the active data

View source: R/quick-summary.R

describeR Documentation

Describe variables in the active data

Description

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.

Usage

describe(..., data = NULL, show = TRUE, console = FALSE)

Arguments

...

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 TRUE.

console

Logical; also print the traditional result in the Console. Default FALSE.

Value

Invisibly returns a data frame.

Examples

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


R4VN documentation built on Sept. 30, 2026, 5:13 p.m.