NVL: Convenience functions for handling 'NULL' objects.

Description Usage Arguments Functions See Also Examples

View source: R/misc.utilities.R

Description

Convenience functions for handling NULL objects.

Usage

1
2
3
NVL(...)

NVL(x) <- value

Arguments

...

Expressions to be tested.

x

an object to be overwritten if NULL.

value

new value for x.

Functions

See Also

NULL, is.null, if

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
a <- NULL

print(a) # NULL
print(NVL(a,0)) # 0

b <- 1

print(b) # 1
print(NVL(b,0)) # 1

# Also,
print(NVL(NULL,1,0)) # 1
print(NVL(NULL,0,1)) # 0
print(NVL(NULL,NULL,0)) # 0
print(NVL(NULL,NULL,NULL)) # NULL

NVL(a) <- 2
a # 2
NVL(b) <- 2
b # still 1

statnet.common documentation built on Aug. 16, 2017, 5:04 p.m.