Learn R Programming

cards (version 0.5.1)

ard_attributes: ARD Attributes

Description

Add variable attributes to an ARD data frame.

  • The label attribute will be added for all columns, and when no label is specified and no label has been set for a column using the label= argument, the column name will be placed in the label statistic.

  • The class attribute will also be returned for all columns.

  • Any other attribute returned by attributes() will also be added, e.g. factor levels.

Usage

ard_attributes(data, ...)

# S3 method for data.frame ard_attributes(data, variables = everything(), label = NULL, ...)

# S3 method for default ard_attributes(data, ...)

Value

an ARD data frame of class 'card'

Arguments

data

(data.frame)
a data frame

...

These dots are for future extensions and must be empty.

variables

(tidy-select)
variables to include

label

(named list)
named list of variable labels, e.g. list(cyl = "No. Cylinders"). Default is NULL

Examples

Run this code
df <- dplyr::tibble(var1 = letters, var2 = LETTERS)
attr(df$var1, "label") <- "Lowercase Letters"

ard_attributes(df, variables = everything())

Run the code above in your browser using DataLab