get.atr: Retrieve tibble attributes

View source: R/get.atr.R

get.atrR Documentation

Retrieve tibble attributes

Description

Retrieves attributes from a tibble object created by haven.

Usage

get.atr(tibble, which, NULLasNA = TRUE, exact = FALSE)

get.nas(tibble, aslist = TRUE)

get.varlab(tibble)

Arguments

tibble

a tibble object.

which

a non-empty character string specifying which attribute is to be accessed.

NULLasNA

a logical value indicating if NULL attributes should be listed as NA. Default is TRUE.

exact

logical: should which be matched exactly?

aslist

a logical value indicating if output should be a list.

Value

A list or a data frame.

Examples

# tibble generated by haven
input <- system.file("extdata/reds", package = "ILSAmerge")
x <- do.call(rbind,justload(inputdir = input,population = "BCGV1"))
x

# Get an attribute
get.atr(tibble = x, which = "label")[1:3]
get.atr(tibble = x, which = "labels")[1:3]
get.atr(tibble = x, which = "format.spss")[1:3]

# Get NAs
get.nas(tibble = x,aslist = TRUE)[10:20]
get.nas(tibble = x,aslist = FALSE)[10:20,]

# Get variable labels
get.varlab(tibble = x)[10:20,]


ILSAmerge documentation built on April 11, 2025, 5:54 p.m.