Learn R Programming

SeuratObject (version 4.1.4)

set-if-na: Set if NA

Description

Set a default value depending on if an object is NA

Usage

x %NA% y

x %na% y

x %!NA% y

x %!na% y

Value

For %NA%: y if x is NA; otherwise x

For %!NA%: y if x is not

NA; otherwise x

Arguments

x

An object to test

y

A default value

Examples

Run this code
1 %NA% 2
NA %NA% 2

1 %!NA% 2
NA %!NA% 2

Run the code above in your browser using DataLab