nonDuplicated: Non Duplicated Rows in Data Frame

View source: R/nonDuplicated.R

nonDuplicatedR Documentation

Non Duplicated Rows in Data Frame

Description

Subset a data frame using non duplicated elements in a vector.

Usage

nonDuplicated(x, y, change.rownames = FALSE, na.rm = FALSE)

Arguments

x

a data frame.

y

a vector. It can be a name of a column in x without quotes.

change.rownames

if original rownames of x are to be replaced by unique non duplicated values of y.

na.rm

logical. If rows should be removed where y is NA. This is to be applied if values of y are used as rownames by setting change.rownames = TRUE

Details

This function is handy to keep only one set of duplicated data that is common in long formatted database files.

Value

A data frame.

Author(s)

Peter Solymos <solymos@ualberta.ca>

See Also

duplicated

Examples

data(abmibirds)
x <- nonDuplicated(abmibirds, abmibirds$ABMI.Site, TRUE)
## or equivalently
#x <- nonDuplicated(abmibirds, ABMI.Site, TRUE)
dim(abmibirds)
dim(x)
length(unique(abmibirds$ABMI.Site))

mefa4 documentation built on June 22, 2024, 11:01 a.m.