| select_tbl | R Documentation |
select_tbl() displays frequency counts and percentages
for multiple response variables (e.g., a series of questions where
participants answer "Yes" or "No" to each item) as well as ordinal
variables (such as Likert or Likert-type items with responses ranging
from "Strongly Disagree" to "Strongly Agree", where respondents select
one response per statement, question, or item).
select_tbl(
data,
var_stem,
var_input = "stem",
regex_stem = FALSE,
ignore_stem_case = FALSE,
na_removal = "listwise",
pivot = "longer",
only = NULL,
var_labels = NULL,
ignore = NULL,
force_pivot = FALSE
)
data |
A data frame. |
var_stem |
A character vector with one or more elements, where each
represents either a variable stem or the complete name of a variable present
in |
var_input |
A character string specifying whether the values
supplied to |
regex_stem |
A logical value indicating whether to use Perl-compatible
regular expressions when searching for variable stems. Default is |
ignore_stem_case |
A logical value indicating whether the search for
columns matching the supplied |
na_removal |
A character string that specifies the method for handling
missing values: |
pivot |
A character string that determines the format of the table. By
default, |
only |
A character string or vector of character strings of the types of
summary data to return. Default is |
var_labels |
An optional named character vector or list used to assign
custom labels to variable names. Each element must be named and correspond
to a variable included in the returned table. If |
ignore |
An optional named vector or list indicating values to exclude
from variables matching specified stems (or names). Defaults to |
force_pivot |
A logical value that enables pivoting to the 'wider'
format even when variables have inconsistent value sets. By default, this is
set to |
A tibble displaying the count and percentage for each category in a multi-response variable.
Ama Nyame-Mensah
select_tbl(data = tas,
var_stem = "involved_",
na_removal = "pairwise")
select_tbl(data = depressive,
var_stem = "dep",
na_removal = "listwise",
pivot = "wider",
only = "percent")
var_label_example <-
c("dep_1" = "how often child feels sad and blue",
"dep_2" = "how often child feels nervous, tense, or on edge",
"dep_3" = "how often child feels happy",
"dep_4" = "how often child feels bored",
"dep_5" = "how often child feels lonely",
"dep_6" = "how often child feels tired or worn out",
"dep_7" = "how often child feels excited about something",
"dep_8" = "how often child feels too busy to get everything")
select_tbl(data = depressive,
var_stem = "dep",
na_removal = "pairwise",
pivot = "longer",
var_labels = var_label_example)
select_tbl(data = depressive,
var_stem = "dep",
na_removal = "pairwise",
pivot = "wider",
only = "count",
var_labels = var_label_example)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.