Topic: Utilities
Topic Description:
Basic R utilities used in many packages and functions, such as date and string manipulations, statistical distributions, geometry of lines and distances. The R package date is required for the two data functions.
File: utilities/utilitiesCTFS.r
| View File Source | Download File | No help file available |
Function: CTFSplot
Function Description: CTFSplot
A convenience for attaching the R Analytical Tables, including the species table. One or more censuses can be requested, and either the 'full' or the 'stem' tables. The path in which R Tables are stored is submitted; if in a folder called CTFSRPackage, then the default works. Within that folder, there must be subfolders named full, stem, and species for the three types of tables. The function 'attach_if_needed' is used, so there is no penalty to requesting a table that is already attached.Function Arguments:
| Argument | Default Value |
|---|---|
| plot | |
| census | 1 |
| type | 'full' |
| path | 'CTFSRPackage' |
| remove | FALSE |
| includespp | TRUE |
Arguments Description:
- plot: Name of plot as it appears in the names of the R Analytical Tables, in quote marks
- census: census numbers as they appear in the names of the R Analytical Tables; can be a vector
- type: either full or stem, in quote marks
- path: the name of the folder in which the tables are stored, defaults to CTFSRPackage
- remove: if TRUE, the tables are detached, otherwise they are attached
- includespp: can be set to FALSE if the species table is not available
Sample Usage:
CTFSplot(plot='bci',census=1:2) CTFSplot(plot='bci',census=2:3) CTFSplot(plot='sinharaja,census=3,type='stem',path='C:/SinharajaRDataTables')
Function Source:
CTFSplot=function(plot,census=1,type='full',path='CTFSRPackage',remove=FALSE,includespp=TRUE)
{
if(includespp)
{
spfile=pst(path,'/species/',plot,'.spptable.rdata')
if(remove) detachfiles(spfile)
else attach_if_needed(spfile)
}
filename=paste(path,'/',type,'/',plot,'.',type,census,'.rdata',sep='')
if(!remove) return(attach_if_needed(filename))
detachfiles(filename)
}
{
if(includespp)
{
spfile=pst(path,'/species/',plot,'.spptable.rdata')
if(remove) detachfiles(spfile)
else attach_if_needed(spfile)
}
filename=paste(path,'/',type,'/',plot,'.',type,census,'.rdata',sep='')
if(!remove) return(attach_if_needed(filename))
detachfiles(filename)
}