Learn R Programming

sjmisc (version 2.5.0)

get_note: Retrieve notes (annotations) from labelled variables

Description

This function retrieves the value of the note-attribute of vectors.

Usage

get_note(x)

Arguments

x

Variable (vector) with note-attribute.

Value

The the value of the note-attribute of x.

Examples

Run this code
# NOT RUN {
library(haven)
# create labelled factor
x <- labelled(c("M", "M", "F", "X", "N/A"),
              c(Male = "M", Female = "F",
                Refused = "X", "Not applicable" = "N/A"))

set_label(x) <- "A labelled vector with note"
set_note(x) <- "Test annotation."
get_note(x)
x

# Annotate simple vector
x <- c(1, 2, 3)
set_note(x) <- "Another note"
x
get_note(x)

# }

Run the code above in your browser using DataLab