Learn R Programming

mefa4 (version 0.3-2)

nonDuplicated: 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

Value

  • A data frame.

Details

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

See Also

duplicated

Examples

Run this code
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))

Run the code above in your browser using DataLab