Learn R Programming

MDM (version 1.3)

y2p: Scale rows of a species-sites data set

Description

The response matrix for mdm diversity analyses requires that species (columns of the data matrix) are scaled to proportions i.e. that they sum to one for each site (row of the data matrix). Two matrices are particularly useful; these correspond to alpha and gamma diversities. The former is particularly useful for mdm anovas that include the alpha model which is computationally expensive using the function mdm.

Usage

y2p(y, mean=FALSE)

Arguments

y
matrix or data frame of numeric values to be transformed
mean
if mean = TRUE then each row is replaced by the species means scaled to row sums of one

Value

A matrix of the same dimensions as the input matrix. Each row of the matrix will sum to one.

Examples

Run this code
mydata <- matrix(0:8,nrow=3,ncol=3)
mydata
y2p(mydata)

Run the code above in your browser using DataLab