Remove rows and columns containing only NA values

removeNA(object, ...)

# S4 method for atomic
removeNA(object)

# S4 method for matrix
removeNA(object)

# S4 method for sparseMatrix
removeNA(object)

# S4 method for data.frame
removeNA(object)

# S4 method for DataFrame
removeNA(object)

Arguments

object

Object.

...

Additional arguments.

Value

Sanitized object.

Examples

## atomic ==== removeNA(c("hello", "world", NA))
#> [1] "hello" "world" #> attr(,"na.action") #> [1] 3 #> attr(,"class") #> [1] "omit"
removeNA(c(1, 2, NA))
#> [1] 1 2 #> attr(,"na.action") #> [1] 3 #> attr(,"class") #> [1] "omit"
## matrix ==== from <- matrix( data = c(1, NA, 3, NA, NA, NA, 2, NA, 4), nrow = 3, ncol = 3 ) print(from)
#> [,1] [,2] [,3] #> [1,] 1 NA 2 #> [2,] NA NA NA #> [3,] 3 NA 4
to <- removeNA(from) print(to)
#> [,1] [,2] #> [1,] 1 2 #> [2,] 3 4
## DataFrame ==== from <- S4Vectors::DataFrame( a = c("A", NA, "C"), b = c(NA, NA, NA), c = c("B", NA, "D") ) print(from)
#> DataFrame with 3 rows and 3 columns #> a b c #> <character> <logical> <character> #> 1 A NA B #> 2 NA NA NA #> 3 C NA D
to <- removeNA(from) print(to)
#> DataFrame with 2 rows and 2 columns #> a c #> <character> <character> #> 1 A B #> 2 C D