fgeo installs and loads multiple R packages, functions, and datasets to analyze trees abundance, demography, and habitats (fgeo.abundance, fgeo.ctfs, fgeo.habitat). It also includes general-purpose functions to simplify the visualization (fgeo.map) and manipulation (fgeo.tool) of ForestGEO datasets (e.g. fgeo.x).


Expected R environment

  • R version is recent
  • All packages are updated (run update.packages())
  • No other R session is running
  • Current R session is clean (click Session > Restart R)

Option 1: Install from GitHub

You need an authenticated GitHub-account (see usethis::browse_github_pat()).

devtools::install_github("forestgeo/fgeo", upgrade = "never")

Option 2: Install via fgeo.install

You don’t need a GitHub account.

  • To upgrade packages see ?devtools::update_packages()
  • To remove packages see ?remove.packages()

Tips to avoid or fix common installation problems

Update R, RStudio, and R packages

Instruct RStudio not to preserve your workspace between sessions

In RStudio go to Tools > Global Options…

Use RStudio projects (or the here package)

Restart R many times each day

Press Cmd/Ctrl + Shift + F10 to restart RStudio or go to Session > Restart R.

Increase the rate limit to install from GitHub

  • Make sure your token description says exactly GITHUB_PAT and click Generate token

  • Store your new token in the environmental variable GITHUB_PAT by running usethis::edit_r_environ() in R.
  • A file called .Renviron will open. Type the name and value of your GitHub token. Ensure to end this file with a new empty line. Your .Renviron file should now look like this:

  • Save and close .Renviron.

Install package development utilities

Sometimes you may want to install the source version of an R package from CRAN or GitHub. If that package contains a src/ folder you will need to install package development utilities.

Troubleshoot: error: X11 library is missing: install XQuartz …

If you are a mac user, fgeo may fail to install with the error below. Install XQuartz from https://www.xquartz.org/ and try to install fgeo again.


Load all fgeo packages in one step.


Determine the status of each tree based on the status of each stem.

Pick stems of 10 mm or more.

Count distinct values of stemID and treeID.

Count largest stems (unique treeIDs) by species.

Get started

R code from recent publications by ForestGEO partners

Data have been made available as required by the journal to enable reproduction of the results presented in the paper. Please do not share these data without permission of the ForestGEO plot Principal Investigators (PIs). If you wish to publish papers based on these data, you are also required to get permission from the PIs of the corresponding ForestGEO plots.


Thanks to all partners of ForestGEO for sharing their ideas and code. For feedback on fgeo, special thanks to Gabriel Arellano, Stuart Davies, Lauren Krizel, Sean McMahon, and Haley Overstreet. There are many other people that deserve special acknowledgements; I thank them in the documentation and home page of each individual package that make up the fgeo development.