in_labels {codelist}R Documentation

Match codes based on label

Description

Match codes based on label

Usage

in_labels(
  x,
  labels,
  codelist = attr(x, "codelist"),
  locale = cl_locale(codelist)
)

Arguments

x

vector with codes. Should be of the same type as the codes in the codelist.

labels

vector with labels.

codelist

a codelist object or a data.frame that is a valid code list or and object that has a 'codelist' attribute containing a codelist.

locale

use the codes from the given locale. Should be character vector of length 1.

Value

A logical vector of the same length as x indicating for each value if the code has a label present in labels.

Examples

data(objectcodes)
data(objectsales)
objectsales$product <- code(objectsales$product, objectcodes)

in_labels(objectsales$product, c("Electric Drill", "Toys"))

subset(objectsales, in_labels(product, c("Electric Drill", "Hammer")))


[Package codelist version 0.1.0 Index]