rmDuplCols: Remove Duplicated Columns from 'data.frame'

View source: R/rmDuplCols.R

rmDuplColsR Documentation

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, ...)

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.

Value

Revised data.frame.

Author(s)

Florian Detsch

See Also

duplicated().

Examples

## 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)


fdetsch/Orcs documentation built on Jan. 9, 2023, 6:14 a.m.