transpose: Transpose (part of) a matrix or dataframe

View source: R/transpose.R

transposeR Documentation

Transpose (part of) a matrix or dataframe

Description

This function transposes (a specified part of) a matrix or data frame, optionally using one of its columns as column names for the transposed result. It can be useful for turning a species presence-absence table into a regional species composition table.

Usage

transpose(data, sp.cols = 1:ncol(data), reg.names = NULL)

Arguments

data

a matrix or data frame containing the species occurrence data to transpose.

sp.cols

names or index numbers of the columns containing the species occurrences in 'data' which are meant to be transposed.

reg.names

name or index number of the column in 'data' containing the region names, to be used as column names in the transposed result.

Value

This function returns the transposed 'sp.cols' of 'data', with the column specified in 'reg.names' as column names.

Author(s)

A. Marcia Barbosa

See Also

t

Examples

data(rotif.env)

head(rotif.env)

names(rotif.env)

rotif.reg <- transpose(rotif.env, sp.cols = 18:47, reg.names = 1)

head(rotif.reg)

fuzzySim documentation built on March 19, 2024, 3:09 a.m.