makeKeysList: Make a keys list

Description Usage Arguments Value Author(s) Examples

View source: R/RFunctions.R

Description

Attempts to generate a keys.list, as used by functions from the psych package, and several functions in this motley package.

Usage

1
2
3
makeKeysList(var_names, questionnaire_filter = "^\\w+\\d+$",
  item_filter = "\\d+$", skip_questionnaires = NULL,
  questionnaire_length = 3L)

Arguments

questionnaire_filter

Character. A regex filter that identifies variable names that are part of a questionnaire.

item_filter

Character. A regex filter that identifies the incremental part of multiple items belonging to the same questionnaire (e.g., if items are labelled c("a1", "a2", "a3"), then the item_filter would be "\d$" ).

skip_questionnaires

Character vector. Names of the questionnaires to skip.

questionnaire_length

Integer. Minimum number of items required to be included in the list of questionnaires.

Value

A named list with elements corresponding to the questionnaires identified. Each element is a character vector with the variable names belonging to that questionnaire.

Author(s)

Caspar J. van Lissa

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
makeKeysList(var_names = c("bfi_1", "bfi_2", "bfi_3", "bfi_4", "bfi_5",
"mac_q_j_1", "mac_q_j_2", "mac_q_j_3", "mac_q_j_4", "mac_q_j_5", "mac_q_j_6",
"mac_q_j_7", "mac_q_j_8", "mac_q_j_9", "mac_q_j_10", "mac_q_j_11",
"mac_q_j_12", "mac_q_j_13", "mac_q_j_14", "mac_q_j_15", "mac_q_j_16",
"mac_q_j_17", "mac_q_j_18", "mac_q_j_19", "mac_q_j_20", "mac_q_j_21",
"mac_q_r_1", "mac_q_r_2", "mac_q_r_3", "mac_q_r_4", "mac_q_r_5", "mac_q_r_6",
"mac_q_r_7", "mac_q_r_8", "mac_q_r_9", "mac_q_r_10", "mac_q_r_11",
"mac_q_r_12", "mac_q_r_13", "mac_q_r_14", "mac_q_r_15", "mac_q_r_16",
"mac_q_r_17", "mac_q_r_18", "mac_q_r_19", "mac_q_r_20", "mac_q_r_21"),
questionnaire_filter = "^[a-zA-Z_]+")

cjvanlissa/motley documentation built on Sept. 23, 2019, 7:39 p.m.