Learn R Programming

IgAScores (version 0.1.2)

relabund: Relative Abundance from Counts

Description

This function converts values in a dataframe to a fraction/percentage of the sum of their column.

Usage

relabund(counttable, percentage = FALSE)

Arguments

counttable

Data frame of numeric values with rows as observations and columns as samples.

percentage

Should values be returned as a percentage? i.e multiplied by 100. Default is FALSE (as required for most IgA scoring approaches).

Value

A data frame of the input data normalised by column (to sum to either 1 or 100).

Examples

Run this code
# NOT RUN {
taxcounts <- data.frame(Sample1=c(1,2,10,10),Sample2=c(3,10,5,1))
rownames(taxcounts) <- c("Taxon1","Taxon2","Taxon3","Taxon4")
relabund(taxcounts)
# }

Run the code above in your browser using DataLab