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

