is-na-categories: is.na for Categories

is-na-categoriesR Documentation

is.na for Categories

Description

Crunch categorical variables allow you to set multiple categories as missing. For instance, you might have "not answered" and "doesn't know" both coded as missing. This function returns a logical vector of all dataset entries that fall into any of the missing categories. It also allows you to append additional categories to the list of missing categories using the setter.

Usage

## S4 method for signature 'Categories'
is.na(x)

## S4 replacement method for signature 'Categories,character'
is.na(x) <- value

## S4 replacement method for signature 'Categories,logical'
is.na(x) <- value

## S4 method for signature 'Category'
is.na(x)

## S4 replacement method for signature 'Category,logical'
is.na(x) <- value

Arguments

x

Categories or a single Category

value

To change the missingness of categories, supply either:

  1. a logical vector of equal length of the categories (or length 1 for the Category method); or

  2. the names of the categories to mark as missing. If supplying the latter, any categories already indicated as missing will remain missing.

Value

Getters return logical, a named vector in the case of the Categories method; setters return x duly modified.


crunch documentation built on Aug. 31, 2023, 1:07 a.m.