knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(befitteR)

Setting parameters

To make it easy to create reports we can first set all the parameters we will need.

As you can also see. Body fat percentage is calculated as a mean of three methods. This is because it will be needed in the kcal report. The body report will use all three methods in it's report.

name        <- "John Doe"
weight      <- 80
height      <- 180
sex         <- "male"
age         <- 30
waist       <- 80
neck        <- 35
hip         <- 100
desired_bmi <- 23
objective   <- 1
effort      <- 1.3
squat       <- 75
bench       <- 50
bfp         <- round(mean(c(
  calculate_bfp(
    height = height,
    sex = sex,
    waist = waist,
    neck = neck,
    equation = "us-navy"
  ),
  calculate_bfp(
    weight = weight,
    height = height,
    age = age,
    sex = sex,
    equation = "bmi"

  ),
  calculate_bfp(
    weight = weight,
    height = height,
    sex = sex,
    waist = waist,
    equation = "woolcott"
  )
), 3))

Body report

create_report(
  output = "body.html",
  title = "Body statistics",
  template_name = "body",
  params = list(
    name = name,
    weight = weight,
    height = height,
    sex = sex,
    age = age,
    waist = waist,
    neck = neck,
    hip = hip,
    desired_bmi = desired_bmi,
    squat = squat,
    bench = bench
  ),
  quiet = TRUE,
  see_now = FALSE
)

Kcal report

create_report(
  output = "kcal.html",
  title = "Calories",
  template_name = "kcal",
  params = list(
    name = name,
    weight = weight,
    height = height,
    sex = sex,
    age = age,
    bfp = bfp,
    objective = objective,
    effort = effort
  ),
  quiet = TRUE,
  see_now = FALSE
)


MarijnJABoer/befitteR documentation built on April 24, 2020, 5:43 a.m.