same.sites(x,y)
check.datasets(x,y)
check.ordiscores(x,ord,check.species=T)
removeNAcomm(x,y,variable)
removeNAenv(x,variable)
removezerospecies(x)
subsetcomm(x,y,factor,level,returncomm=T)
#ifdef windows
import.from.Excel(file = file.choose(), sheet = "community", sitenames = "sites",
column = "species", value = "abundance", factor = "", level = "", cepnames = FALSE)
import.from.Excel2007(file = file.choose(), sheet = "community", sitenames = "sites",
column = "species", value = "abundance", factor = "", level = "", cepnames = FALSE)
import.from.Access(file = file.choose(), table = "community", sitenames = "sites",
column = "species", value = "abundance", factor = "", level = "", cepnames = FALSE)
import.from.Access2007(file = file.choose(), table = "community", sitenames = "sites",
column = "species", value = "abundance", factor = "", level = "", cepnames = FALSE)
#endifmakecommunitydataset.makecommunitydataset.make.cepnames (TRUE) or not (FALSE).same.sites provides a new data frame that has the same row names as the row names of the environmental data set and the same (species) variables as the original community data set. Sites from the original community data set that have no corresponding sites in the environmental data set are not included in the new community data set. (Hint: this function can be especially useful when some sites do not contain any species and where a community dataset was generated by the makecommunitydataset function.)
Function check.datasets checks whether the community and environmental data sets have the same number of rows, and (if this was the case) whether the rownames of both data sets are the same. The function also returns the dimensions of both data sets.
Function check.ordiscores checks whether the community data set and the ordination result have the same number of rows (sites) and columns (species, optional for check.species==TRUE), and (if this was the case) whether the row and column names of both data sets are the same. Site and species scores for the ordination result are obtained via function scores (removeNAcomm and removeNAenv provide a new data frame that does not contain NA for the specified variable. The specifed variable is part of the environmental data set. These functions are particularly useful when using community and environmental datasets, as new community and environmental datasets can be calculated that contain information from the same sample plots (sites). An additional result of removeNAenv is that factor levels of any categorical variable that do not occur any longer in the new data set are removed from the levels of the categorical variable.
Function removezerospecies removes species from a community dataset that have total abundance that is smaller or equal to zero.
Function subsetcomm makes a subset of sites that contain a specified level of a categorical variable from the environmental data set. The same functionality of selecting subsets of the community or environmental data sets are implemented in various functions of diversityresult, renyiresult and accumresult) and have the advantage that it is not necessary to create a new data set. If a community dataset is returned, species that did not contain any individuals were removed from the data set. If an environmental dataset is returned, factor levels that did not occur were removed from the data set.
#ifdef windows
The import.from.XXXX functions provide methods of importing community or environmental datasets through functions odbcConnectExcel and sqlFetch.
For stacked datasets, a community data set is created with function makecommunitydataset. For community data with more species than the limited number of columns in Excel, this may be the only option of importing a community dataset.
An additional advantage of the function is that the community and environmental data can be stored in the same file.
You may want to check compatibility of the community and environmental datasets with functions check.datasets and modify the community dataset through same.sites.
#endiflibrary(vegan)
data(dune.env)
data(dune)
dune.env2 <- dune.env
dune.env2[1:4,"Moisture"] <- NA
dune2 <- removeNAcomm(dune,dune.env2,"Moisture")
dune.env2 <- removeNAenv(dune.env2,"Moisture")
dune3 <- same.sites(dune,dune.env2)
check.datasets(dune,dune.env2)
check.datasets(dune2,dune.env2)
check.datasets(dune3,dune.env2)
dune4 <- subsetcomm(dune,dune.env,"Management","NM",returncomm=TRUE)
dune.env4 <- subsetcomm(dune,dune.env,"Management","NM",returncomm=FALSE)
dune5 <- same.sites(dune,dune.env4)
check.datasets(dune4,dune5)Run the code above in your browser using DataLab