A curated list of open technology projects to sustain a stable climate, energy supply, biodiversity and natural resources.

fgeo

Analyze forest diversity and dynamics.
https://github.com/forestgeo/fgeo

Category: Biosphere
Sub Category: Forest Modeling and Analysis

Keywords

abundance demography dynamic dynamics ecology fgeo forestgeo forests habitat metapackage tree

Keywords from Contributors

tidyverse book setup bookdown data-manipulation grammar tidy-data devtools filesystem curl

Last synced: about 22 hours ago
JSON representation

Repository metadata

[Meta R-package on CRAN] Analyse forest diversity and dynamics

README.Rmd

          ---
output: github_document
editor_options: 
  chunk_output_type: console
---


```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  fig.show = "hold",
  comment = "#>",
  fig.path = "man/figures/README-"
)
```

#  Analyze forest diversity and dynamics


[![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www.tidyverse.org/lifecycle/#maturing)
[![Travis build status](https://travis-ci.org/forestgeo/fgeo.svg?branch=master)](https://travis-ci.org/forestgeo/fgeo)
[![Coverage status](https://codecov.io/gh/forestgeo/fgeo/branch/master/graph/badge.svg)](https://codecov.io/github/forestgeo/fgeo?branch=master)
[![CRAN status](https://www.r-pkg.org/badges/version/fgeo)](https://cran.r-project.org/package=fgeo)


```{r, echo=FALSE}
# Creates a functional link when used with DT table.
fgeo_link <- function(package, topic = NULL) {
  end <- glue::glue(">{package}")
  if (!is.null(topic)) {end <- glue::glue("/reference/>{topic}")}
  glue::glue("")
}

link_core <- function(pattern) {
  core <- fgeo_to_attach()()
  fgeo_link(core[grepl(pattern, core)])
}

analyze <- "analyze"
visualize <- "map"
manipulate <- "tool"
datasets <- "x"
```

__fgeo__ helps you to install, load, and access the documentation of multiple packages to analyze forest diversity and dynamics (`r purrr::map_chr(fgeo::fgeo_packages(include_self = FALSE), fgeo_link)`). This package-collection allows you to manipulate and plot [ForestGEO](http://www.forestgeo.si.edu/) data, and to do common analyses including abundance, demography, and species-habitats associations.

* [Search functions and datasets](https://forestgeo.github.io/fgeo/articles/siteonly/reference.html)
* [Ask questions, report bugs, or propose features](https://github.com/forestgeo/fgeo/issues/new)

## Installation

Make sure your R environment is as follows:

* R version is recent
* All packages are updated (run `update.packages()`; maybe use `ask = FALSE`)
* No other R session is running
* Current R session is clean (click _Session > Restart R_)

Install the latest stable version of __fgeo__ from [CRAN](https://cran.r-project.org/) with:

```R
install.packages("fgeo")
```

Or install the development version of __fgeo__ from [GitHub](https://github.com/) with:

```R
# install.packages("devtools")
devtools::install_github("forestgeo/fgeo.x")
```

* [How to setup .Rprofile for easiest installation of __fgeo__?](https://forestgeo.github.io/fgeo/articles/siteonly/questions-and-answers.html#how-to-setup--rprofile-for-easiest-installation-of-fgeo)
* [How to update __fgeo__?](https://forestgeo.github.io/fgeo/articles/siteonly/questions-and-answers.html#how-to-update-fgeo)
* [How to remove __fgeo__?](https://forestgeo.github.io/fgeo/articles/siteonly/questions-and-answers.html#how-to-remove-fgeo)
* [How to avoid or fix common installation problems?](https://forestgeo.github.io/fgeo/articles/siteonly/questions-and-answers.html#how-to-avoid-or-fix-common-installation-problems)

## Example

```{r example}
library(fgeo)
```

### Explore __fgeo__

On an interactive session, `fgeo_help()` and `fgeo_browse_reference()` help you to search documentation.

```
if (interactive()) {
  # To search on the viewer; accepts keywords
  fgeo_help()
  # To search on a web browser
  fgeo_browse_reference() 
}
```

### Access and manipulate data

`example_path()` allows you to access datasets stored in your R libraries.

```{r}
example_path()

(vft_file <- example_path("view/vft_4quad.csv"))
```

#### `read_()`

`read_vft()` and `read_taxa()` import a ViewFullTable and ViewTaxonomy from .tsv or .csv files.

```{r}
read_vft(vft_file)
```

#### `pick_()` and `drop_()`

__fgeo__ is pipe-friendly. You may not use pipes but often they make code easier to read.

> Use %>% to emphasize a sequence of actions, rather than the object that the actions are being performed on.

-- 

`pick_dbh_under()`, `drop_status()` and friends pick and drop rows from a ForestGEO ViewFullTable or census table.

```{r}
(census <- fgeo.x::tree5)

census %>% 
  pick_dbh_under(100)
```

`pick_main_stem()` and `pick_main_stemid()` pick the main stem or main stemid(s) of each tree in each census.

```{r}
stem <- download_data("luquillo_stem6_random")

dim(stem)
dim(pick_main_stem(stem))
```

#### `add_()`

`add_status_tree()`adds the column `status_tree` based on the status of all stems of each tree.

```{r}
stem %>% 
  select(CensusID, treeID, stemID, status) %>% 
  add_status_tree()
```

`add_index()` and friends add columns to a ForestGEO-like dataframe.

```{r}
stem %>% 
  select(gx, gy) %>% 
  add_index()
```

### Plot data

For simplicity, we will focus on only a few species.

```{r}
stem_2sp <- stem %>% 
  filter(sp %in% c("PREMON", "CASARB"))
```

`autoplot()` and friends produce different output depending on the class of input. You can create different input classes, for example, with `sp()` and `sp_elev()`:

* Use `sp(census)` to plot the column `sp` of a `census` dataset -- i.e. to plot species distribution.

```{r autoplot-sp}
class(sp(stem_2sp))

autoplot(sp(stem_2sp))
```

* Use `sp_elev(census, elevation)` to plot the columns `sp` and `elev` of a `census` and `elevation` dataset, respectively -- i.e. to plot species distribution and topography.

```{r autoplot-sp-elev}
elevation <- fgeo.x::elevation
class(sp_elev(stem_2sp, elevation))

autoplot(sp_elev(stem_2sp, elevation))
```

### Analyze

#### Abundance

`abundance()` and `basal_area()` calculate abundance and basal area, optionally by groups.

```{r}
abundance(
  pick_main_stem(census)
)

by_species <- group_by(census, sp)

basal_area(by_species)
```

#### Demography

`recruitment_ctfs()`, `mortality_ctfs()`, and `growth_ctfs()` calculate recruitment, mortality, and growth. They all output a list. `as_tibble()` converts the output from a list to a more convenient dataframe.

```{r}
tree5 <- fgeo.x::tree5

as_tibble(
  mortality_ctfs(tree5, tree6)
)
```

#### Species-habitats association

`tt_test()` runs a torus translation test to determine habitat associations of tree species. `as_tibble()` converts the output from a list to a more convenient dataframe. `summary()` helps you to interpret the result.

```{r}
# This analysis makes sense only for tree tables
tree <- download_data("luquillo_tree5_random")

habitat <- fgeo.x::habitat
result <- tt_test(tree, habitat)

as_tibble(result)

summary(result)
```

## Downloads of fgeo packages

```{r fgeo-downloads, echo=FALSE, message=FALSE, warning=FALSE}
library(ggplot2)

fgeo::fgeo_packages() %>% 
  cranlogs::cran_downloads(from = "2019-05-09", to = lubridate::today()) %>% 
  ggplot(aes(date, count)) +
    geom_col() +
    labs(caption = "Data from ")
```

## Related projects

Additional packages maintained by ForestGEO but not included in __fgeo__:

* [__fgeo.data__](https://forestgeo.github.io/fgeo.data/): Open datasets of ForestGEO.
* [__fgeo.krig__](https://forestgeo.github.io/fgeo.krig/): Analyze soils.

Other packages not maintained by ForestGEO:

* [CTFS-R Package](http://ctfs.si.edu/Public/CTFSRPackage/): The original package of CTFS functions. No longer supported by ForestGEO.
* [__BIOMASS__](https://CRAN.R-project.org/package=BIOMASS): An R package to estimate above-ground biomass in tropical forests.

## 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.

* [Disentangling fire intensity and species' susceptibility to fire in a species-rich seasonal tropical forest (Trouve et al., 2019).](https://github.com/forestgeo/Trouve_et_al_2019)

* [Soil drivers of local-scale tree growth in a lowland tropical forest (Zemunik et al., 2018).](https://github.com/SoilLabAtSTRI/Soil-drivers-of-tree-growth)

* [Plant diversity increases with the strength of negative density dependence at the global scale (LaManna et al., 2018)](https://github.com/forestgeo/LaManna_et_al_Science)
    * Response #1: LaManna et al. 2018. Response to Comment on "Plant diversity increases with the strength of negative density dependence at the global scale" Science Vol. 360, Issue 6391, eaar3824. DOI: 10.1126/science.aar3824
    * Response #2: LaManna et al. 2018. Response to Comment on "Plant diversity increases with the strength of negative density dependence at the global scale". Science Vol. 360, Issue 6391, eaar5245. DOI: 10.1126/science.aar5245

## Information

* [Getting help](https://forestgeo.github.io/fgeo/SUPPORT.html).
* [Contributing](https://forestgeo.github.io/fgeo/CONTRIBUTING.html).
* [Contributor Code of Conduct](https://forestgeo.github.io/fgeo/CODE_OF_CONDUCT.html).

## Acknowledgments

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. For all other help, I thank contributors in the documentation of the features they helped with.


        
  
    
      

Owner metadata

  • Name: ForestGEO
  • Login: forestgeo
  • Email: [email protected]
  • Kind: organization
  • Description: Forest Global Earth Observatory, Smithsonian Institution
  • Website: http://www.forestgeo.si.edu/
  • Location: Smithsonian Tropical Research Institute
  • Twitter:
  • Company:
  • Icon url: https://avatars.githubusercontent.com/u/25665726?v=4
  • Repositories: 7
  • Last ynced at: 2023-02-26T20:35:33.242Z
  • Profile URL: https://github.com/forestgeo

GitHub Events

Total
  • Watch event: 2
Last Year
  • Watch event: 2

Committers metadata

Last synced: 5 days ago

Total Commits: 703
Total Committers: 20
Avg Commits per committer: 35.15
Development Distribution Score (DDS): 0.196

Commits in past year: 0
Committers in past year: 0
Avg Commits per committer in past year: 0.0
Development Distribution Score (DDS) in past year: 0.0

Name Email Commits
maurolepore m****e@g****m 565
hadley h****m@g****m 107
Haley Overstreet 4****h 5
Lepore L****M@S****U 3
Dirk Eddelbuettel e****d@d****g 3
Gábor Csárdi c****r@g****m 3
Derek Chiu d****u@b****a 2
ForestGEO f****o@s****u 2
Jennifer (Jenny) Bryan j****n@g****m 2
Ben Marwick b****k@h****m 1
Darío Hereñú m****a@g****m 1
Greg Macfarlane g****e@g****m 1
Jim Hester j****r@g****m 1
Matthew Lincoln m****n 1
Michael Toth m****h@g****m 1
Ri Ram e****4@g****m 1
Serhat Cevikel s****l@y****m 1
zhaoy z****y 1
Jennifer (Jenny) Bryan j****y@s****a 1
Rainer Stuetz r****z@a****t 1

Committer domains:


Issue and Pull Request metadata

Last synced: 2 days ago

Total issues: 102
Total pull requests: 112
Average time to close issues: 23 days
Average time to close pull requests: about 12 hours
Total issue authors: 4
Total pull request authors: 4
Average comments per issue: 0.75
Average comments per pull request: 0.15
Merged pull request: 96
Bot issues: 0
Bot pull requests: 0

Past year issues: 0
Past year pull requests: 0
Past year average time to close issues: N/A
Past year average time to close pull requests: N/A
Past year issue authors: 0
Past year pull request authors: 0
Past year average comments per issue: 0
Past year average comments per pull request: 0
Past year merged pull request: 0
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/forestgeo/fgeo

Top Issue Authors

  • maurolepore (99)
  • LisaHuelsmann (1)
  • hmullerlandau (1)
  • teixeirak (1)

Top Pull Request Authors

  • maurolepore (105)
  • overstreeth (5)
  • kant (1)
  • mokhancodes (1)

Top Issue Labels

  • docs (11)
  • feature (5)
  • help wanted (4)
  • bug (3)
  • good first issue (3)
  • hacktoberfest (3)
  • refactor (2)
  • performance (1)
  • wip (1)

Top Pull Request Labels

  • docs (1)

Package metadata

  • Total packages: 1
  • Total downloads:
    • cran: 192 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 2
  • Total maintainers: 1
cran.r-project.org: fgeo

Analyze Forest Diversity and Dynamics

  • Homepage: http://forestgeo.github.io/fgeo
  • Documentation: http://cran.r-project.org/web/packages/fgeo/fgeo.pdf
  • Licenses: GPL-3
  • Latest release: 1.1.4 (published almost 6 years ago)
  • Last Synced: 2025-04-25T12:08:08.403Z (2 days ago)
  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 192 Last month
  • Rankings:
    • Forks count: 6.36%
    • Stargazers count: 10.062%
    • Dependent repos count: 24.382%
    • Average: 26.103%
    • Dependent packages count: 27.984%
    • Downloads: 61.729%
  • Maintainers (1)

Dependencies

DESCRIPTION cran
  • R >= 3.2 depends
  • cli >= 1.1.0 imports
  • crayon >= 1.3.4 imports
  • dplyr >= 0.8.1 imports
  • fgeo.analyze >= 1.1.10 imports
  • fgeo.plot >= 1.1.6 imports
  • fgeo.tool >= 1.2.4 imports
  • fgeo.x >= 1.1.3 imports
  • glue >= 1.3.1 imports
  • magrittr >= 1.5 imports
  • purrr >= 0.3.2 imports
  • rlang >= 0.3.4 imports
  • rstudioapi >= 0.10 imports
  • utils * imports
  • DT >= 0.6 suggests
  • covr >= 3.2.1 suggests
  • kableExtra >= 1.1.0 suggests
  • knitr >= 1.23 suggests
  • rmarkdown >= 1.12 suggests
  • spelling >= 2.1 suggests
  • testthat >= 2.1.1 suggests

Score: 11.977162499321627