LoadCommunity {cheddar}R Documentation

Loading and saving Community objects


LoadCommunity and SaveCommunity are functions for loading and saving Community objects to CSV files.


LoadCommunity(dir, fn='read.csv', ...)
SaveCommunity(community, dir, fn='write.csv', na='', ...)



an object of class Community.


a directory.


the name of an R function that loads/saves CSV files.


the string to use for missing values in the data; see write.csv.


other values to fn.


Data are stored in CSV (Comma-Separated Value) files in dir. Properties of any aspect of the community (nodes, links or the whole community) can be added simply by adding columns to the relevant CSV file. The data-quality checks defined by Community are applied by LoadCommunity. The fn and dots arguments can be used to read/write files in a range of formats.

properties.csv defines items applicable to the community as a whole, such as sampling date, lat & long or altitude and environmental variables such as temperature or pH. This file must contain a column called ‘title’.

nodes.csv should contain the list of nodes and together with any associated properties such as mean body mass, mean numerical abundance and classification. This file must contain a column called ‘node’ that must contain node names. Many of Cheddar's plot and analysis functions make use of the ‘category’ node property by default, following previously-used metabolic groupings (Yodzis & Innes, 1992). The ‘category’ column of nodes.csv is optional but, if given, it should contain one of ‘producer’, ‘invertebrate’, ‘vert.ecto’, ‘vert.endo’ or should be an empty string.

trophic.links.csv is optional. It defines trophic links in columns ‘resource’ and ‘consumer’, which should be names of nodes. Properties of trophic links such as evidence for the presence of the link (e.g. empirically observed or inferred from literature) can be added to this file.


LoadCommunity returns a new Community.


Lawrence Hudson


Yodzis, P. and Innes, S. (1992) Body size and resource-consumer dynamics. The American Naturalist 139, 1151–1175.

See Also

Community, read.csv, write.csv


temp.path <- tempfile()
SaveCommunity(TL84, temp.path)
TL84.loaded <- LoadCommunity(temp.path)
unlink(temp.path, recursive=TRUE)
identical(TL84, TL84.loaded)    # TRUE

[Package cheddar version 0.1-636 Index]