import.from.Excel {BiodiversityR} | R Documentation |
This function provides a method for importing community or environmental data from Excel (through functions odbcConnectExcel
or odbcConnectAccess
). In case of stacked data, a community dataset is formed by function makecommunitydataset
.
import.from.Excel(file = file.choose(), sheet = "community", sitenames = "sites", column = "species", value = "abundance", factor = "", level = "") import.from.Access(file = file.choose(), table = "community", sitenames = "sites", column = "species", value = "abundance", factor = "", level = "")
file |
Location of the Excel file. |
sheet |
Name of the sheet of the Excel file to import: one of "community", "environmental" or "stacked". |
table |
Name of the table of the Access file to import: one of "community", "environmental" or "stacked". |
sitenames |
Name of categorical variable that provides the names for the sites. |
column |
Name of the categorical variable for the columns of the crosstabulation (typically indicating species); passed to makecommunitydataset . |
value |
Name of numerical variable for the cells of the crosstabulation (typically indicating abundance). The cells provide the sum of all values in the data frame; passed to makecommunitydataset . |
factor |
Name of the variable to calculate a subset of the data frame; passed to makecommunitydataset . |
level |
Value of the subset of the factor variable to calculate a subset of the data frame; passed to makecommunitydataset . |
This function provides a method of method 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
.
The function returns a dataset that can be used as community or environmental data for analysis in BiodiversityR.
Roeland Kindt (World Agroforestry Centre)
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/treesandmarkets/tree_diversity_analysis.asp
## Example is not run as requires RODBC ## Check for file "dune.xls" in the etc folder of BiodiversityR ## #### Default 'ordiplot3d' ## Not run: library(RODBC) dunenew <- import.from.Excel(sheet="community", sitenames="sites") dune.envnew <- import.from.Excel(sheet="environmental", sitenames="sites") ## End(Not run)