get_itemnames: Extract item names

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/get_itemnames.R

Description

The get_itemnames() function matches names against the 9-code template. This is useful for quickly selecting names of items from a larger set of names.

Usage

1
2
3
4
5
6
7
8
9
get_itemnames(
  x,
  instrument = NULL,
  domain = NULL,
  mode = NULL,
  number = NULL,
  strict = FALSE,
  itemtable = NULL
)

Arguments

x

A character vector, data.frame or an object of class lean. If not specified, the function will return all item names in itemtable.

instrument

A character vector with 3-position codes of instruments that should match. The default instrument = NULL allows for all instruments.

domain

A character vector with 2-position codes of domains that should match. The default instrument = NULL allows for all domains.

mode

A character vector with 1-position codes of the mode of administration. The default mode = NULL allows for all modes.

number

A numeric or character vector with item numbers. The default number = NULL allows for all numbers.

strict

A logical specifying whether the resulting item names must conform to one of the built-in names. The default is strict = FALSE.

itemtable

A data.frame set up according to the same structure as builtin_itemtable(). If not specified, the builtin_itemtable is used.

Details

The gsed-naming convention is as follows. Position 1-3 codes the instrument, position 4-5 codes the domain, position 6 codes direct/caregiver/message, positions 7-9 is a item sequence number.

Value

A vector with names of items

Author(s)

Stef van Buuren 2020

See Also

sort_itemnames()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
itemnames <- c("aqigmc028", "grihsd219", "", "age", "mdsgmd999")

# filter out impossible names
get_itemnames(itemnames)
get_itemnames(itemnames, strict = TRUE)

# only items from specific instruments
get_itemnames(itemnames, instrument = c("aqi", "mds"))
get_itemnames(itemnames, instrument = c("aqi", "mds"), strict = TRUE)

# get all items from the se domain of iyo instrument
get_itemnames(domain = "se", instrument = "iyo")

# get all item from the se domain with direct assessment mode
get_itemnames(domain = "se", mode = "d")

# get all item numbers 70 and 73 from gm domain
get_itemnames(number = c(70, 73), domain = "gm")

dscore documentation built on Nov. 29, 2020, 1:07 a.m.