View source: R/lpr_extract_notes.R
| lpr_extract_notes | R Documentation |
Extracts notes stored in a dataset's attributes and organizes them into a tidy data frame. This function is particularly useful for processing Stata datasets imported into R that contain variable notes in their attributes.
lpr_extract_notes(data)
data |
A dataset (data frame) containing "expansion.fields" in its attributes. |
This function processes the attributes of a dataset to extract notes that are typically stored in a specific format. It skips any notes associated with "_dta" (dataset-level notes) and only returns variable-specific notes. The function expects the notes to be organized as a list where each element contains exactly three components: variable name, note ID, and note value.
A data frame with three columns:
Name of the variable the note belongs to
Identifier for the note
The actual note text
require(lapop); data(bra23)
# Extract the notes
notesBRA23 <- lpr_extract_notes(bra23)
tail(notesBRA23[notesBRA23$variable_name=="ing4",]) # for ing4 variable
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.