File: as-array.Rd

package info (click to toggle)
r-cran-memisc 0.99.31.8.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 2,136 kB
  • sloc: ansic: 5,117; makefile: 2
file content (39 lines) | stat: -rw-r--r-- 1,047 bytes parent folder | download
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
\name{as.array}
\alias{as.array}
\alias{as.array,data.frame-method}
\title{Converting Data Frames into Arrays}
\description{
  The \code{as.array} for data frames
  takes all factors in a data frame and uses them
  to define the dimensions of the resulting array,
  and fills the array with the values of
  the remaining numeric variables.

  Currently, the data frame must contain all
  combinations of factor levels.
}
\usage{
\S4method{as.array}{data.frame}(x,data.name=NULL,\dots)
}
\arguments{
  \item{x}{a data frame}
  \item{data.name}{
    a character string, giving the name
    attached to the dimension
    that corresponds to the
    numerical variables in the data frame
    (that is, the \code{name} attached to
    the corresponding element of the
    \code{dimnames} list).
    }
  \item{\dots}{other arguments, ignored.}
}
\value{
  An array
}
\examples{
BerkeleyAdmissions <- to.data.frame(UCBAdmissions)
BerkeleyAdmissions
as.array(BerkeleyAdmissions,data.name="Admit")
try(as.array(BerkeleyAdmissions[-1,],data.name="Admit"))
}