overwrite_missing: Assign value to a vector's missing values

Description Usage Arguments Author(s) Examples

Description

%na<-% is a simple shortcut to assign a specific value to all NA elements contained in x.

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
 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

roperators documentation built on Feb. 10, 2022, 1:07 a.m.