| Line 1... |
Line 1... |
| 1 |
% File src/library/base/man/unique.Rd
|
1 |
% File src/library/base/man/unique.Rd
|
| 2 |
% Part of the R package, https://www.R-project.org
|
2 |
% Part of the R package, https://www.R-project.org
|
| 3 |
% Copyright 1995-2014 R Core Team
|
3 |
% Copyright 1995-2016 R Core Team
|
| 4 |
% Distributed under GPL 2 or later
|
4 |
% Distributed under GPL 2 or later
|
| 5 |
|
5 |
|
| 6 |
\name{unique}
|
6 |
\name{unique}
|
| 7 |
\alias{unique}
|
7 |
\alias{unique}
|
| 8 |
\alias{unique.default}
|
8 |
\alias{unique.default}
|
| Line 56... |
Line 56... |
| 56 |
\emph{duplicated} and not just \emph{repeated} elements/rows. That
|
56 |
\emph{duplicated} and not just \emph{repeated} elements/rows. That
|
| 57 |
is, an element is omitted if it is equal to any previous element and
|
57 |
is, an element is omitted if it is equal to any previous element and
|
| 58 |
not just if it is equal the immediately previous one. (For the
|
58 |
not just if it is equal the immediately previous one. (For the
|
| 59 |
latter, see \code{\link{rle}}).
|
59 |
latter, see \code{\link{rle}}).
|
| 60 |
|
60 |
|
| 61 |
Missing values are regarded as equal, but \code{NaN} is not equal to
|
61 |
Missing values (\code{"\link{NA}"}) are regarded as equal, numeric and
|
| 62 |
\code{NA_real_}. Character strings are regarded as equal if they are
|
62 |
complex ones differing from \code{NaN}; character strings will be compared in a
|
| 63 |
in different encodings but would agree when translated to UTF-8.
|
63 |
\dQuote{common encoding}; for details, see \code{\link{match}} (and
|
| - |
|
64 |
\code{\link{duplicated}}) which use the same concept.
|
| 64 |
|
65 |
|
| 65 |
Values in \code{incomparables} will never be marked as duplicated.
|
66 |
Values in \code{incomparables} will never be marked as duplicated.
|
| 66 |
This is intended to be used for a fairly small set of values and will
|
67 |
This is intended to be used for a fairly small set of values and will
|
| 67 |
not be efficient for a very large set.
|
68 |
not be efficient for a very large set.
|
| 68 |
|
69 |
|
| 69 |
When used on a data frame with more than one column, or an array or
|
70 |
When used on a data frame with more than one column, or an array or
|
| 70 |
matrix when comparing dimensions of length greater than one, this
|
71 |
matrix when comparing dimensions of length greater than one, this
|
| 71 |
tests for identity of character representations. This will
|
72 |
tests for identity of character representations. This will
|
| 72 |
catch people who unwisely rely on exact equality of floating-point
|
73 |
catch people who unwisely rely on exact equality of floating-point
|
| 73 |
numbers!
|
74 |
numbers!
|
| 74 |
|
- |
|
| 75 |
Character strings will be compared as byte sequences if any input is
|
- |
|
| 76 |
marked as \code{"bytes"} (see \code{\link{Encoding}}).
|
- |
|
| 77 |
}
|
75 |
}
|
| 78 |
\value{
|
76 |
\value{
|
| 79 |
For a vector, an object of the same type of \code{x}, but with only
|
77 |
For a vector, an object of the same type of \code{x}, but with only
|
| 80 |
one copy of each duplicated element. No attributes are copied (so
|
78 |
one copy of each duplicated element. No attributes are copied (so
|
| 81 |
the result has no names).
|
79 |
the result has no names).
|