invalid
1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
invalid package:gtools R Documentation
_T_e_s_t _i_f _a _v_a_l_u_e _i_s _m_i_s_s_i_n_g, _e_m_p_t_y, _o_r _c_o_n_t_a_i_n_s _o_n_l_y _N_A _o_r _N_U_L_L _v_a_l_u_e_s
_D_e_s_c_r_i_p_t_i_o_n:
Test if a value is missing, empty, or contains only NA or NULL
values.
_U_s_a_g_e:
invalid(x)
_A_r_g_u_m_e_n_t_s:
x: value to be tested
_V_a_l_u_e:
Logical value.
_A_u_t_h_o_r(_s):
Gregory R. Warnes warnes@bst.rochester.edu
_S_e_e _A_l_s_o:
'missing', 'is.na', 'is.null'
_E_x_a_m_p_l_e_s:
invalid(NA)
invalid()
invalid(c(NA,NA,NULL,NA))
invalid(list(a=1,b=NULL))
# example use in a function
myplot <- function(x,y) {
if(invalid(y)) {
y <- x
x <- 1:length(y)
}
plot(x,y)
}
myplot(1:10)
myplot(1:10,NA)