Skip to contents

Adds descriptions as comments to all columns in a given data frame.

Usage

append_meta(results, colname_descriptions)

Arguments

results

A data.frame to be marked up with comments for each column. generated.

colname_descriptions

A named character vector where names match column names of results and values are their descriptions.

Value

The input data.frame with comments added to each column.

Examples


results <- append_meta(
  results = iris,
  colname_descriptions = c(
    "Sepal.Length" = "Length of the sepal in cm",
    "Sepal.Width" = "Width of the sepal in cm",
    "Petal.Length" = "Length of the petal in cm",
    "Petal.Width" = "Width of the petal in cm",
    "Species" = "Species of iris"
  )
)

# Example to show column descriptions are stored as comments
comment(results$Sepal.Length)
#> [1] "Length of the sepal in cm"