nonDuplicated: Non Duplicated Rows in Data Frame

Description Usage Arguments Details Value Author(s) See Also Examples

Description

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

Usage

1
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

1
2
3
4
5
6
7
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 May 2, 2019, 6:15 p.m.