MaxBacteria: Putting the reference bacteria at the last row

View source: R/MaxBacteria.R

MaxBacteriaR Documentation

Putting the reference bacteria at the last row

Description

This function calculates the mean abundance of each bacteria. Then, it creates a matrix where each row contains the abundance of one bacteria at all time points but the bacteria with maximum (or minimum or a bacteria indicated by the user) mean abundance is placed at the last row

Usage

MaxBacteria(nombresOriginal, especieOriginal, E, Tt, which.esp)

Arguments

nombresOriginal

Vector with the bacterial names at the same order than in DaTa. it must be fulfilled that lenght(nombresOriginal)==dim(DaTa)[2]-1

especieOriginal

Matrix that contains at row i the bacterial taxa of bacteria i at all time points

E

Number of bacteria available

Tt

Number of bacteria available

which.esp

If which=="Max" this function puts in the last position of the matrix the bacteria with maximum mean abundance. If which=="Min" this function puts in the last position of the matrix the bacteria with minimum mean abundance. If which is equal to a number this function puts in the last position of the matrix the bacteria that is in the "which" row of the especieOriginal matrix.

Value

Returns a list with

  • especie - Matrix that contains at row i the bacterial taxa of bacteria i at all time points but the bacteria with maximum (or minimum) mean abundance (or the bacteria indicated by the user) is placed at the last row.

  • especiemodi - Matrix that contains at row i the bacterial taxa of bacteria i at time points t=2,...,Tt but the bacteria with maximum (or minimum) mean abundance (or the bacteria indicated by the user) is placed at the last row.

  • nombres - Vector with the bacteria's names placed in the order in which appear in the rows of the matrices especie and especiemodi

  • EE - Row in which the bacterial with maximum (or minimum) mean abundance was (or the value of "which" if which is numerical).

  • EspecieMaxima - Row in which the bacterial with maximum (or minimum) mean abundance (or the bacteria indicated by the user) is in especie.) #'

Examples


names1=c("Bact1","Bact2","Bact3")
set.seed(314)
esp1=t(gtools::rdirichlet(n=4, c(1,3,1)))
e1=3
t1=4

MaxBacteria(names1,esp1,e1,t1,"Max")


names3=c("Bact1","Bact2","Bact3","Bact4","Bact5")
set.seed(314)
esp3=t(gtools::rdirichlet(n=6, c(6,6,1,6,6)))
e3=5
t3=6
MaxBacteria(names3,esp3,e3,t3,"Min")



CoDaLoMic documentation built on April 12, 2025, 2:18 a.m.