knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

jgNutritionTools

The goal of jgNutritionTools is to provide a toolset for the analysis and management of human health and physical data.

Installation

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

# install.packages("devtools")
devtools::install_github("MacDonaldMichael1/jgNutritionTools")
library(jgNutritionTools)

Examples

Assuming a valid DB connection has been made:

  1. Use helper function to display country year combinations
require(RMySQL)

lapply(dbListConnections(MySQL()),
       dbDisconnect)
dbListConnections(MySQL())


mydb <- dbConnect(drv = MySQL(),
                  host="nutritionsecurity-2.ctincuwvvm7w.us-west-2.rds.amazonaws.com",
                  default.file = path.expand("~/.my.cnf"),
                  group = "admin2")
devtools::load_all()
library(tidyverse)
## Show country and DHSYEAR combos for DHS surveys with country code
getCountryYearCom(mydb) %>% head()
  1. Retrieve CHIRPS precipitation data for Burkina Faso in 2003
getPrecip(conn = mydb, countryCode = "854",
          Year = "2003",
          startDate = '2002-01-01',
          endDate = '2003-12-31')[1:5, c(1:2, 23:28)]
  1. Retrieve CHIRTS maximum temperature data for Angola in 2015
getTMax(conn = mydb, countryCode = "024",
        Year = "2015",
        startDate = "2015-01-01",
        endDate = "2015-12-31")[1:5, c(1:2, 23:28)]

Acknowledgements

A portion of the source code for functions in the jgNutritionTools package was developed using code from the ropensci/chirps package. We thank these developers for providing this code under the MIT licence.



MacDonaldMichael1/jgNutritionTools documentation built on Sept. 17, 2022, 6:39 a.m.