ZeroData | R Documentation |
In this function the zeros are removed or replaced using functions of "zCompositions" package that can be used with longitudinal data (because they do not use the information of other rows to make the replacement).
ZeroData(DaTa, method = "multKM", seed = NULL)
DaTa |
data.frame. The first column contains the time point information (natural numbers 1,2,3...). The rest of the columns contain the relative abundance of each bacteria at the different time points. The values of each column must sum 1. |
method |
Character.
|
seed |
Number. Set a seed. Default |
The dataset without zeros.
Palarea-Albaladejo J. and Martín-Fernandez JA. zCompositions – R package for multivariate imputation of left-censored data under a compositional approach. Chemometrics and Intelligent Laboratory Systems 2015; 143: 85-96.
set.seed(2)
dat=gtools::rdirichlet(6,c(1,2,3,1,2,3))
dat2=dat
dat2[2,1]=0
dat2[2,2]=dat[2,1]+dat[2,2]
dat2[4,3]=0
dat2[4,4]=dat[4,3]+dat[4,4]
X <- cbind( c(1:6) ,dat2)
Final=ZeroData(X,"multKM",1)
Final2=ZeroData(X,"multRepl",1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.