Learn R Programming

Orcs (version 1.2.3)

rmDuplCols: Remove Duplicated Columns from data.frame

Description

Automatically detect and remove columns from a data.frame based on duplicated headers.

Usage

rmDuplCols(x, keep_first = TRUE, ...)

Value

Revised data.frame.

Arguments

x

Input data.frame.

keep_first

A logical determining whether the first column of an otherwise duplicated header should be kept, defaults to TRUE.

...

Currently not in use.

Author

Florian Detsch

See Also

Examples

Run this code
## sample data
set.seed(123)
dat <- data.frame(matrix(rnorm(28), nc = 7))
names(dat) <- c("Col1", "Col1", "Col1", "Col2", "Col3", "Col3", "Col4")

dat
rmDuplCols(dat)
rmDuplCols(dat, keep_first = FALSE)

Run the code above in your browser using DataLab