Coder Social home page Coder Social logo

mokhancodes / fgeo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from forestgeo/fgeo

0.0 0.0 0.0 8.39 MB

R packages to analyse forest diversity and dynamics

Home Page: https://forestgeo.github.io/fgeo/.

License: Other

R 79.20% CSS 15.03% JavaScript 5.77%

fgeo's Introduction

Analyze forest diversity and dynamics

lifecycle Travis build status Coverage status CRAN status

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

Quick search – click here to search by package, function, dataset, or help file.

Questions and Answers – click here to find answers to frequently asked questions about fgeo.

Installation

Install the pre-release version of fgeo:

# install.packages("devtools")
devtools::install_github("forestgeo/fgeo@pre-release")

Or install the development version of fgeo:

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

For details on how to install packages from GitHub, see this article.

Example

Load all fgeo packages in one step.

library(fgeo)
#> -- Attaching packages ---------------------------------------------- fgeo 0.0.0.9002 --
#> v fgeo.abundance  0.0.0.9005     v fgeo.habitat    0.0.0.9006
#> v fgeo.data       0.0.0.9005     v fgeo.map        0.0.0.9402
#> v fgeo.demography 0.0.0.9102     v fgeo.tool       0.0.0.9003
#> 

Need help? Use fgeo_help() to search every help file in the fgeo package.

fgeo_help()

You can narrow down your search by using a keyword.

fgeo_help("datasets")

# Short name
stem <- luquillo_stem_1ha
# This dataset comes with multiple censuses.
unique(stem$CensusID)
#> [1] 1 2 3 4 5 6
stem
#> # A tibble: 72,582 x 19
#>    treeID stemID tag   StemTag sp    quadrat    gx    gy MeasureID CensusID
#>     <int>  <int> <chr> <chr>   <chr> <chr>   <dbl> <dbl>     <int>    <int>
#>  1     46     46 1000~ 100001  PSYB~ 921      164.  416.        46        1
#>  2     47     47 1000~ 100002  PSYB~ 921      165.  416         47        1
#>  3     47     48 1000~ 100003  PSYB~ 921      165.  416         48        1
#>  4     47     49 1000~ 100004  PSYB~ 921      165.  416         49        1
#>  5     47     50 1000~ 100005  PSYB~ 921      165.  416         50        1
#>  6     47     51 1000~ 100006  PSYB~ 921      165.  416         51        1
#>  7     47     52 1000~ 100007  PSYB~ 921      165.  416         52        1
#>  8     47     53 1000~ 100008  PSYB~ 921      165.  416         53        1
#>  9     47     54 1000~ 100009  PSYB~ 921      165.  416         54        1
#> 10     47     55 1000~ 100010  PSYB~ 921      165.  416         55        1
#> # ... with 72,572 more rows, and 9 more variables: dbh <dbl>, pom <chr>,
#> #   hom <dbl>, ExactDate <date>, DFstatus <chr>, codes <chr>,
#> #   countPOM <dbl>, status <chr>, date <dbl>

Pick one census from the bottom (n < 0) rank of CensusID.

stem6 <- pick_top(stem, var = CensusID, n = -1)
unique(stem6$CensusID)
#> [1] 6

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

stem6 <- add_status_tree(stem6, status_a = "A", status_d = "D")
alive_trees <- subset(stem6, status_tree == "A")

# Note that alive trees may have some missing, gone or dead stems
some_cols <- c( "treeID", "status_tree", "stemID", "status")
example_tree <- 46
subset(alive_trees, treeID == example_tree, some_cols)
#> # A tibble: 2 x 4
#>   treeID status_tree stemID status
#>    <int> <chr>        <int> <chr> 
#> 1     46 A               46 D     
#> 2     46 A           114033 G

Pick stems of 10 mm or more.

ten_plus <- pick_dbh_min(alive_trees, 10)
range(ten_plus$dbh, na.rm = TRUE)
#> [1]   10 1405

Count distinct values of stemID and treeID.

# Drop missing values of `dbh`
non_missing <- filter(ten_plus, !is.na(dbh))

# Stem abundance
abundance(non_missing)
#> Warning: `treeid`: Duplicated values were detected. Do you need to pick
#> main stems?
#> # A tibble: 1 x 1
#>       n
#>   <int>
#> 1  2564

# Tree abundance (picking main stems -- with highest `hom` and largest `dbh`)
largest_stem <- fgeo.tool::pick_main_stem(non_missing)
abundance(largest_stem)
#> # A tibble: 1 x 1
#>       n
#>   <int>
#> 1  2319

Count largest stems (unique treeIDs) by species.

by_sp <- group_by(largest_stem, sp)
abundance(by_sp)
#> # A tibble: 70 x 2
#> # Groups:   sp [70]
#>    sp         n
#>    <chr>  <int>
#>  1 ALCFLO    11
#>  2 ALCLAT    15
#>  3 ANDINE     1
#>  4 ANTOBT     1
#>  5 ARDGLA     1
#>  6 BUCTET    11
#>  7 BYRSPI    25
#>  8 CALCAL     2
#>  9 CASARB   489
#> 10 CASSYL    58
#> # ... with 60 more rows

Get started

Try fgeo on rstudio.cloud

Related projects

(Not maintained by ForestGEO)

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.

Information

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

fgeo's People

Contributors

benmarwick avatar dchiu911 avatar eddelbuettel avatar gaborcsardi avatar gregmacfarlane avatar hadley avatar jennybc avatar jimhester avatar maurolepore avatar mdlincoln avatar michaeltoth avatar overstreeth avatar riram avatar serhatcevikel avatar zhaoy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.