NA                   package:base                   R Documentation

_N_o_t _A_v_a_i_l_a_b_l_e / "_M_i_s_s_i_n_g" _V_a_l_u_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     'NA' is a logical constant of length 1 which contains a missing
     value indicator.  'NA' can be freely coerced to any other vector
     type.

     The generic function 'is.na' indicates which elements are missing.

     The generic function 'is.na<-' sets elements to 'NA'.

_U_s_a_g_e:

     NA
     is.na(x)
     ## S3 method for class 'data.frame':
     is.na(x)

     is.na(x) <- value

_A_r_g_u_m_e_n_t_s:

       x: an R object to be tested.

   value: a suitable index vector for use with 'x'.

_D_e_t_a_i_l_s:

     The 'NA' of character type is as from R 1.5.0 distinct from the
     string '"NA"'.  Programmers who need to specify an explicit string
     'NA' should use 'as.character(NA)' rather than '"NA"', or set
     elements to 'NA' using 'is.na<-'.

     'is.na(x)' works elementwise when 'x' is a 'list'.  The method
     dispatching is C-internal, rather than via 'UseMethod'.

     Function 'is.na<-' may provide a safer way to set missingness. It
     behaves differently for factors, for example.

_V_a_l_u_e:

     The default method for 'is.na' returns a logical vector of the
     same "form" as its argument 'x', containing 'TRUE' for those
     elements marked 'NA' or 'NaN' (!) and 'FALSE' otherwise.  'dim',
     'dimnames' and 'names' attributes are preserved.

     The method 'is.na.data.frame' returns a logical matrix with the
     same dimensions as the data frame, and with dimnames taken from
     the row and column names of the data frame.

_R_e_f_e_r_e_n_c_e_s:

     Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) _The New S
     Language_. Wadsworth & Brooks/Cole.

     Chambers, J. M. (1998) _Programming with Data. A Guide to the S
     Language_. Springer.

_S_e_e _A_l_s_o:

     'NaN', 'is.nan', etc., and the utility function 'complete.cases'.

     'na.action', 'na.omit', 'na.fail' on how methods can be tuned to
     deal with missing values.

_E_x_a_m_p_l_e_s:

     is.na(c(1, NA))        #> FALSE  TRUE
     is.na(paste(c(1, NA))) #> FALSE FALSE

