forked from emacs-ess/ESS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Extract.factor.Rd
56 lines (51 loc) · 1.64 KB
/
Extract.factor.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
%% ESS BUG: Indentation ([Tab]) does not work if point is after \arguments{..}
%% ------- almost surely because of the (non-escaped) "[".
%% and this, all below is original from the R sources (R-devel, 2014-03-05)
% File src/library/base/man/Extract.factor.Rd
% Part of the R package, http://www.R-project.org
% Copyright 1995-2010 R Core Team
% Distributed under GPL 2 or later
\name{Extract.factor}
\title{Extract or Replace Parts of a Factor}
\alias{[.factor}
\alias{[<-.factor}
\alias{[[.factor}
\alias{[[<-.factor}
\description{
Extract or replace subsets of factors.
}
\usage{
\method{[}{factor}(x, \dots, drop = FALSE)
\method{[[}{factor}(x, \dots)
\method{[}{factor}(x, \dots) <- value
\method{[[}{factor}(x, \dots) <- value
}
\arguments{
\item{x}{a factor}
\item{\dots}{a specification of indices -- see \code{\link{Extract}}.}
\item{drop}{logical. If true, unused levels are dropped.}
\item{value}{character: a set of levels. Factor values are coerced to
character.}
}
\value{
A factor with the same set of levels as \code{x} unless \code{drop = TRUE}.
}
\details{
When unused levels are dropped the ordering of the remaining levels is
preserved.
If \code{value} is not in \code{levels(x)}, a missing value is
assigned with a warning.
Any \code{\link{contrasts}} assigned to the factor are preserved
unless \code{drop = TRUE}.
The \code{[[} method supports argument \code{exact}.
}
\seealso{
\code{\link{factor}}, \code{\link{Extract}}.
}
\examples{
## following example(factor)
(ff <- factor(substring("statistics", 1:10, 1:10), levels = letters))
ff[, drop = TRUE]
factor(letters[7:10])[2:3, drop = TRUE]
}
\keyword{category}