Learn R Programming

datacult (version 0.1.0)

tab_freq_checkbox: Frequency for Checkbox Fields.

Description

Each category (or option) is a variable in the dataframe, and we count the number of sucess in each column. The column percent is the ratio between this count by the observation number.

Usage

tab_freq_checkbox(
  data,
  columns,
  sucess = "checked",
  labels = NULL,
  variable_name = NULL
)

Value

return a dataframe with n and percent

Arguments

data

dataframe object

columns

character vector. Columns to count.

sucess

character scalar. Category indicating the sucess. Defaults to "checked".

labels

character vector.Label of each category. Defaults to NULL.

variable_name

character scalar. Name of field in the form. Defaults to NULL.

Details

Missing values are ignored.

Examples

Run this code
data <- data.frame(
  x1 = c("checked", "checked", "unchecked"),
  x2 = c("checked", "unchecked", "checked")
)
tab_freq_checkbox(data, c("x1", "x2"))

Run the code above in your browser using DataLab