Learn R Programming

BiodiversityR (version 1.5)

crosstabanalysis: Presence-absence Analysis by Cross Tabulation

Description

This function makes a cross-tabulation of two variables after transforming the first variable to presence-absence and then returns results of chisq.test.

Usage

crosstabanalysis(x,variable,factor)

Arguments

x
Data set that contains the variables "variable" and "factor".
variable
Variable to be transformed in presence-absence in the resulting cross-tabulation.
factor
Variable to be used for the cross-tabulation together with the transformed variable.

Value

  • The function returns the results of chisq.test on a crosstabulation of two variables, after transforming the first variable to presence-absence first.

References

Kindt, R. & Coe, R. (2005) Tree diversity analysis: A manual and software for common statistical methods for ecological and biodiversity studies. http://www.worldagroforestry.org/resources/databases/tree-diversity-analysis

Examples

Run this code
library(vegan)
data(dune.env)
crosstabanalysis(dune.env,"Manure","Management")

Run the code above in your browser using DataLab