| Line 1... |
Line 1... |
| 1 |
% File src/library/base/man/dimnames.Rd
|
1 |
% File src/library/base/man/dimnames.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-2015 R Core Team
|
| 4 |
% Distributed under GPL 2 or later
|
4 |
% Distributed under GPL 2 or later
|
| 5 |
|
5 |
|
| 6 |
\name{dimnames}
|
6 |
\name{dimnames}
|
| 7 |
\title{Dimnames of an Object}
|
7 |
\title{Dimnames of an Object}
|
| 8 |
\alias{dimnames}
|
8 |
\alias{dimnames}
|
| Line 15... |
Line 15... |
| 15 |
}
|
15 |
}
|
| 16 |
\usage{
|
16 |
\usage{
|
| 17 |
dimnames(x)
|
17 |
dimnames(x)
|
| 18 |
dimnames(x) <- value
|
18 |
dimnames(x) <- value
|
| 19 |
|
19 |
|
| 20 |
provideDimnames(x, sep = "", base = list(LETTERS))
|
20 |
provideDimnames(x, sep = "", base = list(LETTERS), unique = TRUE)
|
| 21 |
}
|
21 |
}
|
| 22 |
\arguments{
|
22 |
\arguments{
|
| 23 |
\item{x}{an \R object, for example a matrix, array or data frame.}
|
23 |
\item{x}{an \R object, for example a matrix, array or data frame.}
|
| 24 |
\item{value}{a possible value for \code{dimnames(x)}: see the
|
24 |
\item{value}{a possible value for \code{dimnames(x)}: see the
|
| 25 |
\sQuote{Value} section.}
|
25 |
\sQuote{Value} section.}
|
| Line 27... |
Line 27... |
| 27 |
symbols and digits in the constructed dimnames.}
|
27 |
symbols and digits in the constructed dimnames.}
|
| 28 |
\item{base}{a non-empty \code{\link{list}} of character vectors. The
|
28 |
\item{base}{a non-empty \code{\link{list}} of character vectors. The
|
| 29 |
list components are used in turn (and recycled when needed) to
|
29 |
list components are used in turn (and recycled when needed) to
|
| 30 |
construct replacements for empty dimnames components. See also the
|
30 |
construct replacements for empty dimnames components. See also the
|
| 31 |
examples.}
|
31 |
examples.}
|
| - |
|
32 |
\item{unique}{logical indicating that the dimnames constructed are
|
| - |
|
33 |
unique within each dimension in the sense of \code{\link{make.unique}}.}
|
| 32 |
}
|
34 |
}
|
| 33 |
\details{
|
35 |
\details{
|
| 34 |
The functions \code{dimnames} and \code{dimnames<-} are generic.
|
36 |
The functions \code{dimnames} and \code{dimnames<-} are generic.
|
| 35 |
|
37 |
|
| 36 |
For an \code{\link{array}} (and hence in particular, for a
|
38 |
For an \code{\link{array}} (and hence in particular, for a
|
| Line 56... |
Line 58... |
| 56 |
|
58 |
|
| 57 |
Both are \link{primitive} functions.
|
59 |
Both are \link{primitive} functions.
|
| 58 |
|
60 |
|
| 59 |
\code{provideDimnames(x)} provides \code{dimnames} where
|
61 |
\code{provideDimnames(x)} provides \code{dimnames} where
|
| 60 |
\dQuote{missing}, such that its result has \code{\link{character}}
|
62 |
\dQuote{missing}, such that its result has \code{\link{character}}
|
| 61 |
dimnames for each component.
|
63 |
dimnames for each component. If \code{unique} is true as by default,
|
| - |
|
64 |
they are unique within each component via \code{\link{make.unique}(*,
|
| - |
|
65 |
sep=sep)}.
|
| 62 |
}
|
66 |
}
|
| 63 |
\value{
|
67 |
\value{
|
| 64 |
The dimnames of a matrix or array can be \code{NULL} (which is not
|
68 |
The dimnames of a matrix or array can be \code{NULL} (which is not
|
| 65 |
stored) or a list of the same length as \code{dim(x)}. If a list, its
|
69 |
stored) or a list of the same length as \code{dim(x)}. If a list, its
|
| 66 |
components are either \code{NULL} or a character vector with positive
|
70 |
components are either \code{NULL} or a character vector with positive
|
| Line 103... |
Line 107... |
| 103 |
stopifnot(identical(A0, provideDimnames(A)))
|
107 |
stopifnot(identical(A0, provideDimnames(A)))
|
| 104 |
strd <- function(x) utils::str(dimnames(x))
|
108 |
strd <- function(x) utils::str(dimnames(x))
|
| 105 |
strd(provideDimnames(A, base= list(letters[-(1:9)], tail(LETTERS))))
|
109 |
strd(provideDimnames(A, base= list(letters[-(1:9)], tail(LETTERS))))
|
| 106 |
strd(provideDimnames(N, base= list(letters[-(1:9)], tail(LETTERS)))) # recycling
|
110 |
strd(provideDimnames(N, base= list(letters[-(1:9)], tail(LETTERS)))) # recycling
|
| 107 |
strd(provideDimnames(A, base= list(c("AA","BB")))) # recycling on both levels
|
111 |
strd(provideDimnames(A, base= list(c("AA","BB")))) # recycling on both levels
|
| - |
|
112 |
## set "empty dimnames":
|
| - |
|
113 |
provideDimnames(rbind(1, 2:3), base = list(""), unique=FALSE)
|
| 108 |
}
|
114 |
}
|
| 109 |
\keyword{array}
|
115 |
\keyword{array}
|
| 110 |
\keyword{manip}
|
116 |
\keyword{manip}
|