Learn R Programming

ediblecity 0.2.1.900

The goal of ediblecity is to is to estimate the potential of UA to contribute to addressing several urban challenges at the city-scale. Within this aim, we followed the urban challenges defined by the Eklipse project that are followed for nearly all of the European projects focused on Nature-based Solutions. We selected 8 indicators directly related to one or several urban challenges.

Installation

You can install the last LTR version from CRAN:

install.packages("ediblecity")

Alternatively, you can install the development version of ediblecity from r-universe with:

install.packages("ediblecity", repos = "jospueyo.r-universe.dev")

Indicators estimated

The package provides eight indicators that estimate different benefits of urban agriculture:

  • food_production(): Amount of food produced in the city.
  • green_capita(): Green per capita can be computed as raw or as the difference among neighbourhoods.
  • green_distance(): Distance to closest public green area larger than certain surface. It computes also the proportion of homes that are further than a specific threshold.
  • UHI(): Urban heat island as a rasters (stars object) or as numeric values.
  • edible_jobs(): Number of jobs created by commercial urban agriculture.
  • edible_volunteers(): Number of volunteers involved in community urban agriculture.
  • no2_seq(): Amount of NO2 sequestered by urban green (in gr/s).
  • runoff_prev(): Runoff in the city after a specific rain event. It also computes the amount of rainwater harvested by urban agriculture initiatives.

Set a scenario

Although ediblecity can also estimate indicators directly from an sf object, the function set_scenario provides a basic tool to create an scenario combining different proportions of elements of urban agriculture. Some warnings are triggered when the function can’t satisfy the parameters passed by the user.

library(ediblecity)

scenario <- set_scenario(city_example,
                         pGardens = 0.7,
                         pVacant = 0.8,
                         pRooftop = 0.6,
                         pCommercial = 0.5)
#> Only 328 rooftops out of 362.4 assumed satisfy the 'min_area_rooftop'

All attributes of urban agriculture elements are included in city_land_uses dataframe. This can be used as default. Otherwise, a customized dataframe can be provided to compute each indicator.


knitr::kable(city_land_uses)
land_usesediblepublicpGreenjobsvolunteerslocationno2_seq1no2_seq2food1food2CN1CN2water_storage1water_storage2water_storage
Edible private gardenTRUEFALSE0.6FALSEFALSEgarden0.070.090.26.68588010TRUE
Community gardenTRUETRUE1.0FALSETRUEvacant0.070.090.22.28588010TRUE
Commercial gardenTRUEFALSE1.0TRUEFALSEvacant0.070.094.06.68585010TRUE
Rooftop gardenTRUETRUE1.0FALSETRUErooftop0.070.070.22.26788010TRUE
Hydroponic rooftopTRUEFALSE1.0TRUEFALSErooftop0.070.079.019.09898010TRUE
Arable landTRUEFALSE0.6FALSEFALSEno0.000.074.06.6858800FALSE
Normal gardenFALSEFALSE0.6FALSEFALSEno0.070.071.01.07486010TRUE
Permanent cropsTRUEFALSE0.6FALSEFALSEno0.090.094.06.6657700FALSE
VacantFALSEFALSE1.0FALSEFALSEno0.070.091.01.0748700FALSE
GrassFALSETRUE1.0FALSEFALSEno0.070.071.01.0748600FALSE
MulcherFALSETRUE1.0FALSEFALSEno0.000.001.01.0888800FALSE
Raised bedFALSETRUE1.0FALSEFALSEno0.070.071.01.0678800FALSE
TreesFALSEFALSE1.0FALSEFALSEno0.110.111.01.0707700FALSE
Vegetated pergolaFALSETRUE1.0FALSEFALSEno0.070.071.01.0989800FALSE

Contributors

Contributions are welcome! Some of the existing indicators can be improved as well as new indicators can be created. Likewise, the creation of new scenarios can include new elements of urban agriculture or provide further customization.

Scientific collaborations are also welcome! Check my research profile at Google scholar.

Acknowledgements

This research was funded by Edicitnet project (grant agreement nº 776665)

Copy Link

Version

Install

install.packages('ediblecity')

Monthly Downloads

187

Version

0.2.2

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Josep Pueyo-Ros

Last Published

February 4th, 2026

Functions in ediblecity (0.2.2)

edible_volunteers

The number of volunteers involved in urban agriculture in your city
edible_jobs

The jobs created by urban agriculture in your city
green_distance

Distance to closest public green area
food_production

The food produced by urban agriculture in your city
UHI

Heat island effect
city_example

City example
SVF

Sky View Factor for City Example
green_capita

Urban green per capita
city_land_uses

City Land Uses
set_scenario

Set the scenario for your edible city
neighbourhoods_example

Neighbourhoods of City Example
no2_seq

Sequestration of nitrogen dioxide
runoff_prev

Runoff prevention