docu_odf: Get documentation from R data frame.

View source: R/docu_odf.R

docu_odfR Documentation

Get documentation from R data frame.

Description

Get access to information about the dataset and variables via the R-Studio Viewer or the web browser.

Usage

docu_odf(
  input,
  languages = "current",
  style = "viewer",
  replace_missing_language = FALSE,
  variables = "yes"
)

Arguments

input

R data frame (df) or variable from an R data frame (df$var).

languages

Select the language in which the descriptions and labels of the data will be displayed.

  • By default the language that is set to current is displayed (languages = "current").

  • The default-option chooses either the default language(if labels and

  • descriptions without a language tag exist)Otherwise the current language

  • is displayed. (languages = "default").

  • You can choose to view all available language variants by selecting (languages = "all"),

  • or you can select the language by language code, e.g. languages = "en".

style

Selects where the output should be displayed (console ore viewer).By default the metadata information is displayed in the viewer if the viewer is available. (style = "console") (style = "print")

  • You can choose to display the code in both the console and the viewer (style = "both") (style = "all")

  • You can choose to display the code only in the viewer (style = "viewer") (style = "html")

replace_missing_language

If only one language is specified in languages and replace_missing_language is set to TRUE. In case of a missing label or description, the default or english label/description is displayed additionally (if one of these is available).

variables

Indicate whether a list with all the variables should be displayed with the dataset metadata. If the input is a variable/column, the variables-argument will be ignored. Set (variables = "yes") to display the list of variables.

Value

Documentation.

Examples

# get example data from the opendataformat package
df <- get(data("data_odf"))

# view documentation about the dataset in the language that is currently set
docu_odf(df)

# view information from a selected variable in language "en"
docu_odf(df$bap87, languages = "en")

# view dataset information for all available languages
docu_odf(df, languages = "all")

# print information to the R console
docu_odf(df$bap87, style = "print")

# print information to the R viewer
docu_odf(df$bap87, style = "viewer")

# Since the label for language de is missing, in this case the
# english label will be displayed additionally.
attributes(df$bap87)["label_de"] <- ""
docu_odf(df$bap87, languages = "de", replace_missing_language = TRUE)


opendataformat documentation built on April 3, 2025, 11:22 p.m.