count_na: Count the number of NAs in each row or in each column

Description Usage Arguments Value Examples

Description

Count the number of NAs in each row or in each column

Usage

1
count_na(x, along = 1)

Arguments

x

A dataframe or matrix.

along

Along which dimension to count the NAs in (1 = rows, 2=columns).

Value

A vector givning the number of NAs for each row or column.

Examples

1
2
3
4
5
6
7
x <- d.ngo

# count NAs row-wise across all variables
count_na(x)

# count NAs column-wise
count_na(x, along=2)

Example output

  [1] 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 [38] 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
 [75] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[112] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[149] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[186] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[223] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    idnr jahrgang   geschl stunzahl  hausauf abschalt leistung begabung 
       0        0        0        0        0        4        0        0 
  urteil englisch  deutsch    mathe     zeng zdeutsch   zmathe    index 
       0        0        0        0        0        0        0        0 
   leist 
       0 

ryouready documentation built on May 1, 2019, 8:39 p.m.