%na<-% {roperators} | R Documentation |
Assign value to a vector's missing values
Description
%na<-%
is a simple shortcut to assign a specific value to all
NA elements contained in x.
Usage
x %na<-% value
Arguments
x |
a vector |
value |
value to replace vector's missing values with |
Author(s)
Ben Wiseman, benjamin.wiseman@kornferry.com
Examples
x <- c("a", NA, "c")
x %na<-% "b"
print(x)
# "a" "b" "c"
x <- c(1, NA, 3, NA)
x %na<-% c(2,4)
print(x)
# 1 2 3 4
[Package roperators version 1.3.14 Index]