{"id":16272887,"url":"https://github.com/robitalec/irg","last_synced_at":"2026-01-21T17:02:56.387Z","repository":{"id":45851749,"uuid":"160579850","full_name":"robitalec/irg","owner":"robitalec","description":":package: irg is an R package for calculating the instantaneous rate of green-up.","archived":false,"fork":false,"pushed_at":"2024-11-10T18:58:30.000Z","size":1401,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-03T19:54:03.179Z","etag":null,"topics":["irg","modis","ndvi","r"],"latest_commit_sha":null,"homepage":"https://robitalec.github.io/irg/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robitalec.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":"codemeta.json","zenodo":null}},"created_at":"2018-12-05T21:18:27.000Z","updated_at":"2025-03-22T08:13:07.000Z","dependencies_parsed_at":"2022-09-05T06:51:15.473Z","dependency_job_id":"351c46d8-e7d1-4417-8229-2e558e5c53b8","html_url":"https://github.com/robitalec/irg","commit_stats":{"total_commits":361,"total_committers":1,"mean_commits":361.0,"dds":0.0,"last_synced_commit":"e78123f5b4bf118573b3846fa95bb8ba7ebd7df8"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/robitalec/irg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robitalec%2Firg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robitalec%2Firg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robitalec%2Firg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robitalec%2Firg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robitalec","download_url":"https://codeload.github.com/robitalec/irg/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robitalec%2Firg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28636658,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T15:01:31.228Z","status":"ssl_error","status_checked_at":"2026-01-21T14:42:58.942Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["irg","modis","ndvi","r"],"created_at":"2024-10-10T18:20:13.114Z","updated_at":"2026-01-21T17:02:56.369Z","avatar_url":"https://github.com/robitalec.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\nalways_allow_html: yes\n---\n\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/robitalec/irg/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/robitalec/irg/actions/workflows/R-CMD-check.yaml)\n[![lifecycle](https://img.shields.io/badge/lifecycle-active-green.svg)](https://www.tidyverse.org/lifecycle/#active)\n[![CRAN status](https://www.r-pkg.org/badges/version/irg)](https://cran.r-project.org/package=irg)\n\u003c!-- badges: end --\u003e\n\n\n\n\n```{r setup, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n# irg\n`irg` is an R package for calculating the instantaneous rate of green-up (IRG).\nIt can be used to fit a double logistic curve to a time series of normalized\ndifference vegetation index (NDVI) and calculate IRG, as described in Bischoff\net al. (2012) [[1]](#references). IRG helps identify the timing of green-up and\ncan be used to determine if migratory animals are \"surfing\" a green-wave of high\nquality forage or if non-migratory animals are selecting available resources at\nthe peak IRG in their environments. \n\n~~At the moment, the `irg` package is designed to work with MODIS imagery, but\nwe're working on adding other sensors~~. Update: we recently added an example\nLandsat 8 dataset. The `irg` package functions have been updated to be more\nflexible to different sensors. Let us know (open an issue!) if you use a sensor\nother than MODIS for calculating IRG. Thanks!\n\n\n\n## Approach\nThe `irg` package opts for a tabular calculation of IRG as opposed to a raster\nbased approach. Sampling imagery is left up to the user and a prerequisite\nfor all functions. The main input (`DT`) for all functions is a\n[`data.table`](https://github.com/Rdatatable/data.table) of an NDVI time series.\nThe sampling unit (`id`) is flexible (a decision for the user) though we would\nanticipate points or polygons, or maybe a pixel. All functions leverage the\nspeed of `data.table` to efficiently filter, scale, and model NDVI time series\nand calculate IRG.\n\nMore details in the first vignette: \n[Getting started with IRG](https://robitalec.github.io/irg/articles/getting-started-with-irg.html). \n\n\n## Installation\n\nInstall with CRAN\n\n```{r, eval = FALSE}\n# Install \ninstall.packages('irg')\n```\n\nor R-universe\n\n```{r, eval = FALSE}\n# Enable the robitalec universe\noptions(repos = c(\n    robitalec = 'https://robitalec.r-universe.dev',\n    CRAN = 'https://cloud.r-project.org'))\n\n# Install \ninstall.packages('irg')\n```\n\n\n\n## Usage\n\nIRG is calculated by filtering an NDVI time series, scaling variables, modeling\nthe time series with a double logistic curve and taking the first derivative of\nthis curve.\n\nHere, the example uses  use the meta function `irg`. Generally, users should opt\nfor the individual filtering, scaling, modeling and irg functions separately to\ntweak settings and column names (see \n[Getting started with IRG](https://robitalec.github.io/irg/articles/getting-started-with-irg.html)).\n\n```{r ggIRG, message = FALSE, warning = FALSE}\nlibrary(data.table)\nlibrary(ggplot2)\nlibrary(irg)\n\n# Load package data\nndvi \u003c- fread(system.file(\"extdata\", \"sampled-ndvi-MODIS-MOD13Q1.csv\", package = \"irg\"))\n\n# Filter and scale NDVI\nfilter_ndvi(ndvi)\nscale_ndvi(ndvi)\nscale_doy(ndvi)\n\n# Guess starting parameters\nmodel_start(ndvi, id = 'id', year = 'yr')\n\n# Double logistic model parameters given starting parameters for nls\nmods \u003c- model_params(\n  ndvi,\n  returns = 'models',\n  id = 'id', year = 'yr',\n  xmidS = 'xmidS_start', xmidA = 'xmidA_start',\n  scalS = 0.05,\n  scalA = 0.01\n)\n\n# Fit double log to NDVI\nfit \u003c- model_ndvi(mods, observed = FALSE)\n\n# Calculate IRG for each day of the year\ncalc_irg(fit)\n\n# Plot IRG and NDVI for 1 year at 1 point\ncols \u003c- c('IRG' = '#14c62f', 'NDVI' = '#47694d')\n\nrandom_yr \u003c- sample(fit$yr, 1)\nrandom_id \u003c- sample(fit$id, 1)\n\nggplot(fit[yr == random_yr \u0026 id == random_id], aes(x = t)) +\n\tgeom_line(aes(y = irg, color = 'IRG')) +\n\tgeom_line(aes(y = fitted, color = 'NDVI')) +\n\tgeom_point(aes(y = scaled), data = ndvi[yr == random_yr \u0026 id == random_id]) + \n\tscale_color_manual(values = cols) +\n\tlabs(y = '', color = '')\n```\n\n\u003c!-- \u003cimg src=\"man/figures/README-ggIRG-1.png\" style=\"max-width:100%;min-width:40px;margin:0px auto;\"/\u003e --\u003e\n\n\n## Functions\n\n\u003cimg src=\"man/figures/functions-grphviz.png\" style=\"max-width:100%;min-width:40px;float:center;\"/\u003e\n\n  \n## Contributing\nContributions welcome! See details in [CONTRIBUTING.md](CONTRIBUTING.md). \n\nPlease note that the `irg` package is released with a \n[Contributor Code of Conduct](CODE_OF_CONDUCT.md). \nBy contributing to this package, you agree to abide by its terms.\n\n## Thanks\nTo [Mike Laforge](https://mammalspatialecology.weebly.com/)\n([\\@MamlSpatialEco](https://twitter.com/MamlSpatialEco)) and \n[Eric Vander Wal](https://weel.gitlab.io) for thoughtful discussion that \nstimulated development of this package. \n\n## References\n\n[[1]](https://www.journals.uchicago.edu/doi/abs/10.1086/667590) Bischof, R., Loe, L. E., Meisingset, E. L., Zimmermann, B., Van Moorter, B., \u0026 Mysterud, A. (2012). A migratory northern ungulate in the pursuit of spring: jumping or surfing the green wave? *The American Naturalist*, 180(4), 407-424.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobitalec%2Firg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobitalec%2Firg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobitalec%2Firg/lists"}