label_table: Create Data Frame of Variable or Value Labels.

Description Usage Arguments Value Examples

View source: R/label_table.R

Description

This enables you to inspect labels at the variable or value label. If requesting value labels for a var, the default is to also tabulate the frequencies and percents. Can provide an optional column of weights to calculated weighted frequencies and percentages.

Usage

1
label_table(data, var, freq = TRUE, weight)

Arguments

data

A data frame where variable or value labels are requested.

var

If value labels are requested, provide corresponding column (unquoted) in the data frame.

freq

Logical, whether or not to tabulate frequencies for the value labels.

weight

An unquoted column of weights.

Value

A data frame of variable or value labels.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
library(dplyr)
library(labelled)
library(iterake)

df <-
  data.frame(
    x = sample(c(1, 2), 100, replace = TRUE),
    w = rnorm(100, 1, 0.1)
  ) %>%
  set_variable_labels(
    x = "Gender",
    w = "Weight"
  ) %>%
  set_value_labels(
    x = c("Male" = 1, "Female" = 2)
  )

label_table(df)
label_table(df, x, freq = FALSE)
label_table(df, x)
label_table(df, x, weight = w)

ttrodrigz/iterake documentation built on July 1, 2020, 7:46 a.m.