Skip to content

GMBog/greenfeedr

Repository files navigation

greenfeedr

CRAN Status CRAN Downloads CRAN Downloads

Overview

greenfeedr is an R package to easily download, process, and report GreenFeed data.

Function Description
get_gfdata() Download GreenFeed data via the C-Lock API
process_gfdata() Process GreenFeed records into daily and weekly estimates, with automatic or manual parameter selection
report_gfdata() Generate summary reports of GreenFeed data
pellin() Process pellet intakes from GreenFeed units
viseat() Process and summarize GreenFeed visit patterns

Citation

If you use greenfeedr in your research, please cite:

Martinez-Boggio et al. (2025). greenfeedr: An R package for processing and reporting GreenFeed data. JDS Communications. https://doi.org/10.3168/jdsc.2024-0662

In R, run citation("greenfeedr") to get the formatted reference.

Installation

To install the latest stable release from CRAN:

install.packages("greenfeedr")

For the development version with the latest updates:

install.packages("remotes")
remotes::install_github("GMBog/greenfeedr")

Recommended workflow

GreenFeed units record gas emissions during voluntary animal visits. Because visit frequency varies across animals and days, the reliability of emission estimates depends on how records are aggregated — specifically, the minimum number of records per day (param1) and the minimum number of days per week (param2).

process_gfdata() handles this automatically. By default, it evaluates all parameter combinations, performs a diurnal analysis, and selects the combination that maximises the composite repeatability (ICC) of emission estimates while retaining at least 80% of study animals. The selected parameters, repeatability statistics, and a ready-to-paste methods sentence are printed to the console.

Automatic mode (recommended):

library(greenfeedr)

data <- get_gfdata(
  username   = "your_username",
  password   = "your_password",
  unit_id    = "your_unit_id",
  start_date = "2024-05-13",
  end_date   = "2024-05-20"
)

processed <- process_gfdata(
  data       = data,
  start_date = "2024-05-13",
  end_date   = "2024-05-20"
)

The function prints the selected parameters and their repeatability, and attaches the full optimisation table and diurnal analysis to the output for inspection:

attr(processed, "optimization")   # full parameter grid results
attr(processed, "diurnal")$plot   # diurnal emission curve

Manual mode — if you prefer to specify parameters directly:

processed <- process_gfdata(
  data       = data,
  start_date = "2024-05-13",
  end_date   = "2024-05-20",
  param1     = 2,
  param2     = 3,
  min_time   = 2
)

ShinyApp

Prefer a point-and-click interface? Run the interactive ShinyApp directly on your computer:

greenfeedr::run_gfapp()

The app covers the full workflow — downloading, processing, and reporting — without writing any code.

Tutorials

Step-by-step guides for common workflows:

Cheat Sheet

Getting help

If you encounter a bug, please file an issue with a minimal reproducible example on GitHub.

For questions or feedback, contact Guillermo Martinez-Boggio.

About

An R Package for Processing & Reporting GreenFeed Data

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages