Last chance! 50% off unlimited learning
Sale ends in
Coerce to a Data Frame
# S4 method for CompositionMatrix
as.data.frame(x, row.names = rownames(x), optional = FALSE, ...)# S4 method for GroupedComposition
as.data.frame(
x,
row.names = rownames(x),
optional = FALSE,
...,
group_var = ".group"
)
# S4 method for LogRatio
as.data.frame(x, row.names = rownames(x), optional = FALSE, ...)
# S4 method for GroupedLogRatio
as.data.frame(
x,
row.names = rownames(x),
optional = FALSE,
...,
group_var = ".group"
)
# S4 method for OutlierIndex
as.data.frame(x, row.names = rownames(x), optional = FALSE, ...)
A data.frame
.
An R object (typically, a CompositionMatrix
object).
A character
vector giving the row names for the data
frame, or NULL
.
A logical
scalar: should the names of the variables in
the data frame be checked? If FALSE
then the names of the variables in the
data frame are checked to ensure that they are syntactically valid variable
names and are not duplicated.
Currently not used.
A character
string specifying the name of the column to
create for group attribution.
N. Frerebeau
Other mutators:
mutators
,
totals()
## Create a count matrix
A1 <- matrix(data = sample(1:100, 100, TRUE), nrow = 20)
## Coerce to compositions
B <- as_composition(A1)
## Row sums are internally stored before coercing to relative frequencies
totals(B)
## This allows to restore the source data
A2 <- as_amounts(B)
## Coerce to a data.frame
X <- as.data.frame(B)
head(X)
Run the code above in your browser using DataLab