powered by
Subset a data frame using non duplicated elements in a vector.
nonDuplicated(x, y, change.rownames = FALSE, na.rm = FALSE)
A data frame.
a data frame.
a vector. It can be a name of a column in x without quotes.
x
if original rownames of x are to be replaced by unique non duplicated values of y.
y
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
NA
change.rownames = TRUE
Peter Solymos <solymos@ualberta.ca>
This function is handy to keep only one set of duplicated data that is common in long formatted database files.
duplicated
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