inflate {mefa}R Documentation

Inflate a Data Frame

Description

The function inflates a data frame based on count values in a vector corresponding the rows.

Usage

inflate(x, by)

Arguments

x a matrix or data frame, but can be a vector.
by a vector containing positive (non zero) integers.

Details

Each rows of the data frame x will be repeated as many times as the corresponding value in the vector by. This function is called internally by the function stcs.

Value

A data frame with columns as in the original (x) and sum(by) number of rows.

Author(s)

Péter Sólymos, solymos@ualberta.ca

References

Sólymos P. 2008. mefa: an R package for handling and reporting count data. Community Ecology 9, 125–127.

http://mefa.r-forge.r-project.org/

See Also

stcs

Examples

x <- data.frame(sample = LETTERS[c(1,1,2,2,3)],
    species = letters[c(5,5,5,6,7)],
    count = c(1,2,10,3,4), segment = letters[c(8,9,8,9,8)])
x
inflate(x[,c(1,2,4)], x[,3])

[Package mefa version 3.0-0 Index]