MyNixOS website logo
Description

Calculate the Cost and Environmental Impact of a Ideal Diet.

Easily perform a Monte Carlo simulation to evaluate the cost and carbon, ecological, and water footprints of a set of ideal diets. Pre-processing tools are also available to quickly treat the data, along with basic statistical features to analyze the simulation results — including the ability to establish confidence intervals for selected parameters, such as nutrients and price/emissions. A 'standard version' of the datasets employed is included as well, allowing users easy access to customization. This package brings to R the 'Python' software initially developed by Vandevijvere, Young, Mackay, Swinburn and Gahegan (2018) <doi:10.1186/s12966-018-0648-6>.

DIETCOST

This package is the R version of the DIETCOST SOFTWARE, providing tools to easily perform Monte Carlo simulations, aiming to evaluate the cost and environmental impact of a diet. Also provided are tools to manipulate the data and to conduct basic statistical analysis of the results.

Installation

You can install the development version of DIETCOST from GitHub with:

# install.packages("devtools")
devtools::install_github("hbracarense/dietcost")

Example

The main function of this package is monteCarloSimulation(), displayed bellow:

library(DIETCOST)
monteCarloSimulation(5, DIETCOST::foods, DIETCOST::nutrient_targets, DIETCOST::food_groups, person = 'woman', 'PF', c(1,2,3), 0.5, allow_discretionary = TRUE, allow_alcohol = TRUE, allow_takeaway = TRUE)
#> [1] "All meals formed will be saved as .csv files in directory C:/Users/hbrac/OneDrive/Documentos/Nutrição/Produtos/Pacote/dietcost/results_20250501154825"
#> [1] "Iteration: 1"
#> [1] "We are too high on fat. Current: 9052.80054495475. Max: 513.1"
#> [1] "FARINHA LACTEA impacts fat and intake must be between 0 and 0. Options: 0. Current: 0"
#> [1] "Changing FARINHA LACTEA intake from 0 to 0"
#> [1] "Iteration: 2"
#> [1] "We are too high on sugars_perc. Current: 0.110025397298352. Max: 0"
#> [1] "ACUCAR DIETCOST impacts sugars_perc and intake must be between 0 and 0. Options: 0. Current: 0"
#> [1] "Changing ACUCAR DIETCOST intake from 0 to 0"
#> [1] "Iteration: 3"
#> [1] "We are too high on CHO. Current: 21691.0158021275. Max: 2887.5"
#> [1] "SALAME impacts CHO and intake must be between 0 and 0. Options: 0. Current: 0"
#> [1] "Changing SALAME intake from 0 to 0"
#> [1] "Iteration: 4"
#> [1] "We are too high on fibre. Current: 2824.541160645. Max: 700"
#> [1] "DOCE DE FRUTAS DIETCOST impacts fibre and intake must be between 0 and 0. Options: 0. Current: 0"
#> [1] "Changing DOCE DE FRUTAS DIETCOST intake from 0 to 0"
#> [1] "Iteration: 5"
#> [1] "We are too high on redmeat. Current: 1950. Max: 196"
#> [1] "LINGUICA NO VAREJO DIETCOST impacts redmeat and intake must be between 0 and 0. Options: 0. Current: 0"
#> [1] "Changing LINGUICA NO VAREJO DIETCOST intake from 0 to 0"

This function saves in the top directory a report containing the stats of the run. It also creates a folder, which will store the resulting diets, if any is formed, as a .csv.

The development of this package also encompassed the creation of a ‘standard table’, whose use is greatly advised to ensure better results. Although the usage of this package is possible with different dataset formats, choosing to adopt the ‘standard table’ makes DIETCOST so much easier.

This table is made availabe throught the GitHub repo and also as .xlsx on the external data folder of the package. Said folder also houses two script examples.

Finally, this package also contains the already preprocessed datased, which can be accessed and stored into R dataframes as bellow:

foods_df <- DIETCOST::foods
food_groups_df <- DIETCOST::food_groups
nutrient_targets <- DIETCOST::nutrient_targets

Please report any bugs or submit any queries either to this GitHub repo or to [email protected].

Metadata

Version

1.0.0.0

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows