Learn R Programming

wrMisc (version 2.0.0)

naOmit: Fast na.omit

Description

This function removes NAs from input vector, in contrast to na.omit this function has no slot for removed elements.

Usage

naOmit(x, silent = FALSE, debug = FALSE, callFrom = NULL)

Value

This function returns a vector without NAs (matrix input will be transformed to vector). Returns NULL if input consists only of NAs.

Arguments

x

(vector or matrix) data to check & remove NAs

silent

(logical) suppress messages if TRUE

debug

(logical) additional messages for debugging

callFrom

(character) allows easier tracking of messages produced

Details

Resulting objects from naOmit are smaller in size and subsequent code execution (on large vectors) may be faster (in particular if many NAs get encountered). Note : This function behaves differently to na.omit with input other than plain vectors. Will not work with data.frames !

See Also

na.fail, na.omit

Examples

Run this code
aA <- c(11:13,NA,10,NA); 
naOmit(aA) 

Run the code above in your browser using DataLab