as.na {bazar}R Documentation

Transform values to NA

Description

These methods transform values to NA for different classes of objects.

Usage

as.na(x, ...)

## Default S3 method:
as.na(x, ...)

## S3 method for class 'data.frame'
as.na(x, ...)

## S3 method for class 'list'
as.na(x, ...)

Arguments

x

The object at stake.

...

Additional arguments (unused).

Value

An object of the same class as x; the attributes of x are passed unchanged to the result.

Examples

x <- c("a", "b", "c")
as.na(x)
class(as.na(x)) # still a character

x <- factor(LETTERS)
as.na(x)        # levels are kept
class(as.na(x)) # still a factor

x <- data.frame(x = 1:3, y = 2:4)
as.na(x)
dim(as.na(x))

x <- matrix(1:6, 2, 3)
attr(x, "today") <- Sys.Date()
as.na(x)        # attributes are kept


[Package bazar version 1.0.11 Index]