Last chance! 50% off unlimited learning
Sale ends in
Coerce to a Data Frame
# S4 method for CompositionMatrix
as.data.frame(x, ..., group_var = ".group", group_after = 0)# S4 method for LogRatio
as.data.frame(x, ..., group_var = ".group", group_after = 0)
# S4 method for OutlierIndex
as.data.frame(x, row.names = rownames(x), optional = FALSE, ...)
A data.frame
.
An R object (typically, a CompositionMatrix
object).
Further parameters to be passed to
as.data.frame()
.
A character
string specifying the name of the column to
create for group attribution (only used if x
is grouped).
An integer
specifying a subscript, after which the new
group_var
column is to be appended (only used if x
is grouped).
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.
N. Frerebeau
## 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