first_label_get {madshapR}R Documentation

Get the first label from a data dictionary

Description

This function retrieves the first variable and category labels from a data dictionary. It checks if the labels are present, and if not, returns empty strings. The function also determines the class of the data dictionary based on its attributes and structure. The function first validates the input using as_data_dict_shape. It then attempts to extract the first variable label from the 'Variables' section of the data dictionary. If categories are present, it will also extract the first relevant category label. The class of the data dictionary is determined based on its attributes and structure.

Usage

first_label_get(data_dict)

Arguments

data_dict

A list of data frame(s) representing metadata.

Details

A data dictionary contains the list of variables in a dataset and metadata about the variables and can be associated with a dataset. A data dictionary object is a list of data frame(s) named 'Variables' (required) and 'Categories' (if any). To be usable in any function, the data frame 'Variables' must contain at least the name column, with all unique and non-missing entries, and the data frame 'Categories' must contain at least the variable and name columns, with unique combination of variable and name.

Value

A named character vector with the following elements:

Examples

{
 # use madshapR_examples provided by the package
 data_dict <- madshapR_examples$`data_dictionary_example`
 first_label_get(data_dict)

}


[Package madshapR version 2.0.0 Index]