| dict | R Documentation |
Creates a dictionary from an explicit data frame or active R4VN data.
dict(
...,
data = NULL,
describe = TRUE,
file = NULL,
title = "Data dictionary",
open = TRUE
)
... |
Optional variable selectors. For backward compatibility, an explicit data frame may be supplied first. |
data |
Optional explicit data frame. When omitted, active data is used. |
describe |
Logical; include compact descriptive summaries. |
file |
Output HTML file. |
title |
Dictionary title. |
open |
Logical; open the generated file. |
The HTML path invisibly.
d <- data.frame(sex = c(1, 2), age = c(20, NA))
usedf(d, quiet = TRUE)
path <- dict(file = tempfile(fileext = ".html"), open = FALSE)
file.exists(path)
# Extended usage examples
d <- data.frame(sex = c(1, 2, 1), age = c(20, 30, NA), bmi = c(21, 24, 26))
labvar(d, sex, label = "Sex", values = c("1" = "Male", "2" = "Female"))
labvar(d, age, label = "Age in years")
# Dictionary for every variable
f1 <- dict(d, file = tempfile(fileext = ".html"), open = FALSE)
# Dictionary for selected variables
f2 <- dict(d, sex, age, file = tempfile(fileext = ".html"), open = FALSE)
# Omit descriptive summaries
f3 <- dict(d, describe = FALSE, file = tempfile(fileext = ".html"), open = FALSE)
# Active-data syntax
usedf(d, quiet = TRUE)
f4 <- dict(file = tempfile(fileext = ".html"), open = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.