Functions

Body Mass Index (BMI)

This function measures the body fat based on the height and the weight of a person.

\[BMI = Weight/Size^2\]

  • Weight in kilograms
  • Size in centimeters
library(McDonald)

x <- 180 #size in centimeters
y <- 75 #weight in kilos
bmi <- McDonald::bmi(x,y)
bmi %>% kableExtra::kable(col.names = "BMI", align = "l")
BMI
23.14815

Basal Metabolic Rate (BMR)

The function calculates the amount of energy expended per day in a neutral environment.

\[BMR = Weight*Coefficient*24*LeanFactor\]

  • Weight in kilograms
  • Coefficient : male = 1 and female = 0
  • Lean factor: depends on the gender and the body fat percentage (BMI) - See table below

y <- 75 #weight in kilos
coefficient <- 1 #coefficient corresponding to the gender (1 for male and 0.9 for female)
d <- 24 #fix value
leanfactor <- 0.9 #lean factor that correspond to the gender and its respective BMI (see table), here 0.9
bmr <- McDonald::bmr(y, coefficient, d, leanfactor)
bmr %>% kableExtra::kable(col.names = "BMR", align = "l")
BMR
1620

Calorie need

This function computes the daily calorie need according to the BMR and the weekly physical activity.

\[Calories=BMR*multiplier\]

Physical activity (multiplier):

  • Very light = 1.30
  • Light = 1.55
  • Moderate = 1.65
  • Heavy = 1.80
  • Very heavy = 2
multiplier <- 1.65 #depends on your weekly phisical activites, here moderate activity = 1.65
needs <- McDonald::needs(bmr, multiplier)
needs %>% kableExtra::kable(col.names = "Daily calorie need", align = "l")
Daily calorie need
2673

Walking time

Walking time in minutes needed to burn off the calories absorbed.

\[Walking=Kcal/((MET*3.5*Weight)/200)\]

  • Kcal: calories absorbed
  • MET: metabolic equivalent of task
    • Walking at a normal pace = 3
    • Walking at fast pace = 4.5
  • Weight in kilos
y <- 75
MET <- 3 #normal walking = 3, fast walking = 4.5
e <- 3.5
f <- 200
kcal <- 850 #calories absorbed
walking_time <- McDonald::walking_time(y, MET, e, f, kcal) %>% round(digits = 0)
walking_time %>% kableExtra::kable(col.names = "Walking time in minutes at a normal pace", align = "l")
Walking time in minutes at a normal pace
216

Running the shiny application

McDonald::run()