| elements | R Documentation |
Elements of the array x corresponding to the rows of the two dimensional
object subscripts are extracted. The number of columns of subscripts
corresponds to the number of dimensions of x.
The effect of supplying less columns in subscripts than the
number of dimensions in x is the same as for "[".
elements(x, subscripts)
x |
An |
subscripts |
A two dimensional object interpreted as elements by dimensions. |
A vector containing the extracted elements and whose length equals the
number of rows in the subscripts object.
Chris Brien
Extract
## Form a table of the means for all combinations of Row and Line.
## Then obtain the values corresponding to the combinations in the data frame x,
## excluding Row 3.
x <- fac.gen(list(Row = 2, Line = 4), each =2)
x$y <- rnorm(16)
RowLine.tab <- tapply(x$y, list(x$Row, x$Line), mean)
xs <- elements(RowLine.tab, subscripts=x[x$"Line" != 3, c("Row", "Line")])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.