inlist_str: inlist string function

View source: R/summary.R

inlist_strR Documentation

inlist string function

Description

Works the same as inlist but for strings. It determines if the character of interest (i.e. the category) has been checked in mutiple choice questions bound as vectors of delimited string characters e.g. inlist_str(c("peas, carrots","peas, beans, apple","cheese, nuts","peas, pineapple"),"peas") would return 1, 0, 1, 1 as it searched for 'peas' in a list and only the 1st, 3rd, and 4th elements contained 'peas'. this is similar to grepl

Usage

inlist_str(
  srch_var,
  match_var,
  delimiter = "@@#@@",
  threshold = 1,
  binary_return = TRUE
)

Arguments

srch_var

a vector of characters each a delimited list of string items, see inlist. This is common output to mutliple choice questions.

match_var

an atomic or vector or values to match against each element. for example if you wanted to know who selected options "peas" and "carrots" then this argument would be c("peas","carrots")

delimiter

the delimiter used for the data. default is set to ", "

Examples

inlist_str_function()

clmacleod/highlandr documentation built on Oct. 11, 2023, 8:04 p.m.