The CTFS R package is no longer maintained by ForestGEO.
You can view the CTFS R Package by clicking here.
The CTFS R Package includes a wide variety of R functions aimed at analysis of data from CTFS forest census plots. Most of the functions use the CTFS R Analytical tables, which are tables of plot data organizing tree and stem measurements in a precise format. The Package also includes many supporting functions that carry out basic, oft-used calculations, such as date conversion, geometry, model-fitting, probability distributions, and rearrangment of R data objects.
The CTFS R Package can be most easily installed by downloading a single rdata object that includes all functions ready-to-use. The functions are organized into Topics, and full descriptions and help pages presented for each (see menu to the left). There are also in-depth Tutorials for many of the topics. The source can be viewed there, and can also be downloaded (instructions below). With the source code, you will be able edit it the source code, if you see improvements or want to tailor to your own needs. The CTFS R Package cannot be found at R's Cran web site.
The CTFS R Package makes use of other R packages that are not part of the Base package. These packages must be installed separately. The one additional package currently needed is listed here.
Download the rdata object CTFSRPackage.rdata.
Save the file into a new folder where-ever you like; I assume below it is in the folder CTFSRPackage.
You will need to know what your computer considers the complete path name for this folder, let's say /home/My Computer/R Functions/CTFSRPackage/.
Start-up R on your computer.
Use the R function attach to load the functions
> attach('/home/My Computer/R Functions/CTFSRPackage/CTFSRPackage.rdata')
of course naming the folder whereever you saved the rdata file.
> ls(2) that all the functions are loaded. They are ready to use.
If you attach additional R objects, the search position of the CTFSRPackage changes. You can find it with > search()
All the CTFS R Functions will always appear at one search position.
You need to attach every time you start R. If you are a skilled R user, you will know to copy the attach command into the R Profile so the CTFS R Package is loaded automatically at start-up.
You do not need to download the source code, but it is available in case you want to edit functions. Click the Topics option on the menu in the left side-bar, an option will appear to download either the rdata object (just describe), or a zip file with all the source code. The source code is organized into folders matching the topic names, and includes a file called startCTFS.r to assist in sourcing the code. In addition, individual files for each topic can be downloaded separately once you are inside the topic.
CTFS R Analytical Tables
Details can be found in the Data_Format link in the left panel menu. The CTFS R Package can be used with other census data as long as the records are organized in a matching format and have a few key fields, such as a measurement, a date on which the measurement was made, geographic coordinates, and a status to indicate alive or dead.
CTFS R Package Topics
All files are organized within folders called Topics. You can see the full list of Topics and files within each by exploring the content menu in the left panel. Drilling down into the menu will get you help pages for every function in every Topic. If you downloaded the source code, check inside the appropriate subfolder where you unzipped the CTFS R Package to see the files.
CTFS R Package Help
All functions in all files of every Topic have help pages. For example, click Topics in the left panel menu,
then biomass -> biomass.CTFSdb function. The command help(biomass.CTFSdb) is not available.
CTFS R Package Tutorials
Many of the Topics have Tutorials. Click Tutorials in the left panel menu, then biomass for a tutorial on using the biomass functions.
Other R Packages Needed
Some functions of the CTFS R Package make use of R functions in packages that are not part of the standard download (the base package. The packages required and the functions needing them are given below. If these packages are not installed, you will get an error reporting that a function cannot be found. The function install.packages, which is part of the standard download, makes it very easy to install these.
- date (required by tojulian and fromjulian in utilities, which are in turn required by mortality, growth, abundance)
The CTFS R Package was developed with the support of NSF grant #1046113 to Stuart J. Davies through the NSF-IRCN program on the Dimensions of Biodiversity.