library(befitteR)
name <- params$name
weight <- params$weight
height <- params$height
sex <- params$sex
age <- params$age
waist <- params$waist
neck <- params$neck
hip <- params$hip
desired_bmi <- params$desired_bmi
bench <- params$bench
squat <- params$squat

Settings

print(data.frame(
  settings = c(
    "Name",
    "Weight (kg)",
    "Height (cm)",
    "Sex",
    "Age (years)",
    "Waist circumference (cm)",
    "Neck cirfcumference (cm)",
    "Hip cirfcumference (cm)",
    "Desired BMI",
    "1RM bench",
    "1RM squat"
  ),
  input = c(
    name,
    weight,
    height,
    sex,
    age,
    waist,
    neck,
    hip,
    desired_bmi,
    bench,
    squat
  )
), row.names = FALSE)
(bmi <- calculate_bmi(weight = weight, height = height))
(bmi_prime <- calculate_bmi_prime(bmi = bmi))
(pi <- calculate_pi(weight = weight, height = height))
(healthy <- calculate_healthy_weight(height = height))
(
  ideal <- calculate_ideal_weight(
    height = height,
    desired_bmi = desired_bmi,
    equation = "peterson"
  )
)
(
  bfp_navy <- calculate_bfp(
    height = height,
    sex = sex,
    waist = waist,
    neck = neck,
    equation = "us-navy"
  )
)
(
  bfp_bmi <- calculate_bfp(
    weight = weight,
    height = height,
    age = age,
    sex = sex,
    equation = "bmi"
  )
)
(
  bfp_woolcott <- calculate_bfp(
    weight = weight,
    height = height,
    sex = sex,
    waist = waist,
    equation = "woolcott"
  )
)
(
  bfp_strongur <- calculate_bfp(
    weight = weight,
    height = height,
    sex = sex,
    bench = bench,
    squat = squat,
    equation = "strongur"
  )
)
(
  bfp_ymca <- calculate_bfp(
    weight = weight,
    sex = sex,
    waist = waist,
    equation = "ymca"
  )
)
(bfp <- mean(c(
  bfp_navy, bfp_bmi, bfp_woolcott, bfp_strongur, bfp_ymca
)))
(goal <- ideal - weight)
(bsa <-
   calculate_bsa(
     weight = weight,
     height = height,
     sex = sex,
     equation = "du-bois"
   ))
# TODO(MJABOER): add measures as params.
# calculate_muscle_mass(
#   height = height,
#   sex = sex,
#   fg = 24,
#   cg = 34,
#   c_skinfold = 0.2,
#   tg = 55,
#   t_skinfold = 0.2
# )

Measures

data.frame(
  Measure = c(
    "Body Mass Index",
    "BMI prime",
    "Ponderal Index",
    "Healthy weight (kg)",
    "Ideal weight (kg)",
    "Body fat % (navy)",
    "Body fat % (bmi)",
    "Body fat % (woolcott)",
    "Body fat % (strongur)",
    "Body fat % (YMCA)",
    "Body fat % (mean)",
    "Weight goal (kg)",
    "Body surface Area (m^2^)"
  ),
  Value = c(
    round(bmi, 2),
    round(bmi_prime, 2),
    round(pi, 2),
    paste(round(healthy, 2), collapse = " - "),
    round(ideal, 2),
    round(bfp_navy, 2),
    round(bfp_bmi, 2),
    round(bfp_woolcott, 2),
    round(bfp_strongur, 2),
    round(bfp_ymca, 2),
    round(bfp, 2),
    round(goal, 2),
    round(bsa, 2)
  )
)

Weight goal

# Calculate weight goal (negative for weight loss, positive for weight gain)
check_weight_goal(
  weight = weight,
  sex = sex,
  bfp = bfp,
  goal = goal
)


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