%na<-% | R Documentation |
%na<-%
is a simple shortcut to assign a specific value to all
NA elements contained in x.
x %na<-% value
x |
a vector |
value |
value to replace vector's missing values with |
Ben Wiseman, benjamin.wiseman@kornferry.com
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.