tbl_ord {ordr} | R Documentation |
A unified ordination object class
Description
These functions wrap ordination objects in the class tbl_ord, create tbl_ords directly from matrices, and test for the class and basic structure.
Usage
as_tbl_ord(x)
## S3 method for class 'tbl_ord'
as_tbl_ord(x)
make_tbl_ord(rows = NULL, cols = NULL, ...)
is_tbl_ord(x)
is.tbl_ord(x)
valid_tbl_ord(x)
un_tbl_ord(x)
Arguments
x |
An ordination object. |
rows , cols |
Matrices to be used as factors of a tbl_ord. |
... |
Additional elements of a custom tbl_ord. |
Details
The tbl_ord class wraps around a range of ordination classes, making
available a suite of ordination tools that specialize to each original object
class. These tools include format()
and fortify()
methods, which
facilitate the print()
method and the ggbiplot()
function.
No default method is provided for as_tbl_ord()
, despite most defined
methods being equivalent (simply appending 'tbl_ord' to the vector of object
classes). This prevents objects for which other methods are not defined from
being re-classed as tbl_ords.
The function make_tbl_ord()
creates a tbl_ord structured as a list of two
matrices, u
and v
, which must have the same number of columns and the
same column names.
is_tbl_ord()
checks an object x
for the tbl_ord class; valid_tbl_ord()
additionally checks for consistency between recover_coord(x)
and the
columns of recover_rows(x)
and recover_cols(x)
, using the recoverers.
un_tbl_ord()
removes attributes associated with the tbl_ord class in order
to restore an object that was originally passed to as_tbl_ord
.
Value
A tbl_ord (as*()
, make*()
), an S3-class model object that can be
wrapped as one (un*()
), or a logical value (is*()
, value*()
).
Examples
# illustrative ordination: FA of Swiss social data
swiss_fa <- factanal(swiss, factors = 3L, scores = "regression")
print(swiss_fa)
# add the 'tbl_ord' wrapper
swiss_fa_ord <- as_tbl_ord(swiss_fa)
# inspect wrapped model
is_tbl_ord(swiss_fa_ord)
print(swiss_fa_ord)
valid_tbl_ord(swiss_fa_ord)
# unwrap the model
un_tbl_ord(swiss_fa_ord)
# create a 'tbl_ord' directly from row and column factors
# (missing inertia & other attributes)
swiss_fa_ord2 <- make_tbl_ord(rows = swiss_fa$scores, cols = swiss_fa$loadings)
# inspect wrapped factors
is_tbl_ord(swiss_fa_ord2)
print(swiss_fa_ord2)
valid_tbl_ord(swiss_fa_ord2)
# unwrap factors
un_tbl_ord(swiss_fa_ord2)