selection: selection: S3 class for a list of Read, OPCS and/or ICD-10...

Description Usage Arguments Value See Also Examples

View source: R/selection.R

Description

This class is used in the generation of codelists (see the codelist class). Selections differ from codelists in that they can contain terms from more than one source dictionary, but they are Boolean (terms are included or not) without categories. Also they do not have any associated metadata, and are not allowed to have missing data.

The special Boolean operators %AND%, %OR% and NOT can be used to combine selections, automatically coercing their arguments to selections (e.g. using termhas if one of the arguments is a character string). They can also be combined using the conventional Boolean operators & (AND), | (OR) and ! (NOT), but the result will be a selection only if all the arguments are already selection objects.

Usage

1
2
3

Arguments

x

a codelist, character string or logical vector as long as the number of rows in CALIBER_DICT to convert to a selection object. If it is a character string, the terms are searched in a non-case-sensitive manner using termhas.

category

if converting a codelist to a selection, a numeric vector of categories to include in the selection.

categories

alternative spelling for the category argument.

...

other arguments to pass to selection.

Value

a selection object.

See Also

print.selection, length.selection. Functions which return a selection: termhas, codematch

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
setdictionary('opcs')

# generating selections using codes or terms
termhas('bronchoscop')
codematch('E5[01]', 'opcs')

# selection invokes termhas if the argument is a character string
selection('bronchoscop')

# the selection special Boolean operators automatically invoke
# termhas if necessary
termhas('bronchoscop') %AND% termhas('laser')
termhas('bronchoscop') & termhas('laser')

# if the argument to termhas is already a selection, 
# it is not modified
termhas('bronchoscop' %AND% 'laser')
'bronchoscop' %AND% 'laser'

'bronchoscop' %AND% NOT('diagnostic')

CALIBERcodelists documentation built on Feb. 28, 2020, 3:01 a.m.