nobs                  package:gdata                  R Documentation

_C_o_m_p_u_t_e _t_h_e _N_u_m_b_e_r _o_f _N_o_n-_m_i_s_s_i_n_g _O_b_s_e_r_v_a_t_i_o_n_s

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

     Compute the number of non-missing observations.  Special methods
     exist for data frames, and lm objects.

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

     nobs(x, ...)
     ## Default S3 method:
     nobs(x, ...)
     ## S3 method for class 'data.frame':
     nobs(x, ...)
     ## S3 method for class 'lm':
     nobs(x, ...)

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

       x: Target Object 

     ...: Optional parameters (currently ignored)

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

     In the simplest case, this is really just wrapper code for
     'sum(!is.na(x))'.

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

     A single numeric value or a vector of values (for data.frames)
     giving the number of non-missing values.

_A_u_t_h_o_r(_s):

     Gregory R. Warnes gregory.r.warnes@pfizer.com

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

     'is.na', 'length'

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

     x <- c(1,2,3,5,NA,6,7,1,NA )
     length(x)
     nobs(x)

     df <- data.frame(x=rnorm(100), y=rnorm(100))
     df[1,1] <- NA
     df[1,2] <- NA
     df[2,1] <- NA

     nobs(df)

