Skip to contents

Conforms two community data tables to have the same set of columns (species)

Usage

conformveg(x, y, fillvalue = 0, verbose=FALSE)

Arguments

x

Community data, a site-by-species matrix.

y

Community data, a site-by-species matrix.

fillvalue

The value to be used to fill new entries in inflated matrices.

verbose

Displays information about the number of species shared between x and y, as well as the number of species that are in one of the data tables but not in the other.

Details

This function adds to x as many new columns as columns of y that are not in x. The same is done for y, so the two tables have the same set of columns when they are returned.

Value

A list with the two inflated matrices x and y.

Author

Miquel De Cáceres, Centre Tecnologic Forestal de Catalunya.

See also

Examples

## Loads data (38 columns and 33 species)
data(wetland)
dim(wetland)
#> [1] 41 33

## Splits wetland data into two matrices of 30x27 and 11x22
wetland.30 = wetland[1:30,]
wetland.30 = wetland.30[,colSums(wetland.30)>0]
dim(wetland.30)
#> [1] 30 27
wetland.11 = wetland[31:41,]
wetland.11 = wetland.11[,colSums(wetland.11)>0] 
dim(wetland.11)
#> [1] 11 22

## Conforms the two matrices so they can eventually be merged
wetland.cf = conformveg(wetland.30, wetland.11)
dim(wetland.cf$x)
#> [1] 30 33
dim(wetland.cf$y)
#> [1] 11 33
names(wetland.cf$x)==names(wetland.cf$y)
#>  [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
#> [16] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
#> [31] TRUE TRUE TRUE