Description Usage Arguments Details Value Note Author(s) References See Also Examples
Report shape
,
unique row and column id
s,
and row and column metadata
annotations
of an object of class biom
.
1 2 3 4 5 6 7 8 9 |
x |
an object ( |
... |
unused |
BIOM (Biological Observation Matrix) is a simple prescription for storing an annotated table of data. It may be described as a format, standard, or data structure.
The JSON (JavaScript Object Notation) standard for expressing general data objects as text is employed to define BIOM. Therefore the native form of BIOM data is structured text, conforming to the JSON specification in general and the BIOM specification in particular. Familiarity with BIOM is assumed here.
The S3 class biom
and its methods facilitate analyses
by expressing BIOM data as objects in the R environment.
The functions above apply to an R object that is already of class biom
.
dim()
returns the dimensions of the BIOM data table (its shape
).
dimnames()
returns the unique row and column id
s required by BIOM.
metadata()
returns the row and column metadata
annotations
provided for by BIOM. They may be empty.
For dim()
, a length-two integer
vector,
with additional attribute "nnz"
(number not zero)
if the object is "sparse"
,
equaling the number of values (rows) in the sparse representation.
See note below.
For dimnames()
, a list
of two character
vectors,
named "rows"
and "columns"
.
For metadata()
, a list
(invisibly) of two components,
named "rows"
and "columns"
.
Each is a list
equal in length to the data table's corresponding dimension.
When x
is "sparse"
the dimensions of as.matrix(x)
are not given by dim(x)
.
Rather, the latter has dimensions c("nnz", 3)
. See above.
Also note that BIOM requires no exact structure for the metadata annotations of each row (column). All that is guaranteed is a list (possibly of empty, atomic, or nested list elements) with as many entries as the data table has rows (columns).
Daniel T. Braithwaite
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 | ## one toy example, one real example:
dd <- biom (dmat, quiet=TRUE)
ff <- biom (li4, quiet=TRUE)
dim (dd)
dim (ff)
dim (as.matrix (ff))
dim (as.matrix (ff, expand=TRUE))
dimnames (dd)
dimnames (ff)
## automatic row and column ids:
dimnames (biom (smat, sparse=TRUE, quiet=TRUE))
## no metadata:
print (metadata (dd))
## simple metadata:
ss <- biom (li3)
print (as.matrix (ss))
metadata (ss) $ columns
## complicated metadata, so look only at part:
head (metadata(ff) $ rows)
str (metadata(ff) $ columns [[1]])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.