Delete specified columns for dataframe or matrix

Share:

Description

Delete specified columns for dataframe or matrix.

Usage

1
rm.col(mat, to.rm = NULL)

Arguments

mat

a dataframe or matrix, must have column names.

to.rm

a character vector representing the column names that to be removed.

Value

A dataframe or matrix (according to the input data)with certain column deleted.

Author(s)

Jinlong Zhang jinlongzhang01@gmail.com

References

None

Examples

1
2
3
4
x <- rnorm(600)
dim(x) <- c(20,30)
colnames(x) <- paste("col",1:30,sep = "")
rm.col(x, to.rm = c("col1", "col3", "col8", "col22", "col30"))

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.