subset | R Documentation |
Operators acting on objects to extract or replace parts.
## S4 method for signature 'CompositionMatrix,missing,missing,missing'
x[i, j, ..., drop = TRUE]
## S4 method for signature 'CompositionMatrix,missing,missing,logical'
x[i, j, ..., drop = TRUE]
## S4 method for signature 'CompositionMatrix,index,missing,missing'
x[i, j, ..., drop = TRUE]
## S4 method for signature 'CompositionMatrix,index,missing,logical'
x[i, j, ..., drop = TRUE]
## S4 method for signature 'CompositionMatrix,missing,index,missing'
x[i, j, ..., drop = TRUE]
## S4 method for signature 'CompositionMatrix,missing,index,logical'
x[i, j, ..., drop = TRUE]
## S4 method for signature 'CompositionMatrix,index,index,missing'
x[i, j, ..., drop = TRUE]
## S4 method for signature 'CompositionMatrix,index,index,logical'
x[i, j, ..., drop = TRUE]
## S4 replacement method for signature 'CompositionMatrix'
x[i, j, ...] <- value
## S4 replacement method for signature 'CompositionMatrix'
x[[i, j, ...]] <- value
x |
An object from which to extract element(s) or in which to replace element(s). |
i , j |
Indices specifying elements to extract or replace. Indices are
|
... |
Currently not used. |
drop |
A |
value |
A possible value for the element(s) of |
A subsetted object of the same sort as x
.
N. Frerebeau
Other subsetting methods:
bind
,
extract()
,
split()
## Data from Aitchison 1986
data("hongite")
## Coerce to compositional data
coda <- as_composition(hongite)
head(coda)
## Subset
coda[[1, 1]] # Get the first value
coda[1] # Get the first value
coda[, ] # Get all values
coda[1, ] # Get the first row
## Subcomposition
subcoda <- coda[, 1:3] # Get the first three column
head(subcoda)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.