Takes vectors as input and outputs a matrix of the complete cases across these vectors.

completeVecs(...)

Arguments

...

The vectors that need to be combined.

Value

A matrix with the same number of columns as there are input vectors.

Note

Short vectors are recycled without warnings. If your vectors are different lengths, you should decide whether this is a desirable behavior or not before using this function.

References

http://stackoverflow.com/a/20146003/1270695

Author

Ananda Mahto

Examples

A <- c(12, 8, 11, 9, NA, NA, NA) B <- c(NA, 7, NA, 10, NA, 11, 9) completeVecs(A, B)
#> A B #> [1,] 8 7 #> [2,] 9 10
C <- c(1, 2, NA) completeVecs(A, B, C)
#> A B C #> [1,] 8 7 2 #> [2,] 9 10 1