Skip to content

Instantly share code, notes, and snippets.

@dreidpath dreidpath/DJT-BMI.R
Created Feb 15, 2019

Embed
What would you like to do?
Visual analysis of Donald Trumps likely BMI
# A quick visual analysis of Donald Trump's BMI assuming that his reported weight
# in 2018 and 2019 are correct, and his real height lies between his claimed
# height of 6'3" (1.9m) and a more likely height of 6'1" (1.854m)
# https://www.theguardian.com/us-news/2018/jan/17/a-tall-tale-accuracy-of-trumps-medical-report-and-new-height-questioned
# Include the ggplot library
library(ggplot2)
# Function to calculate BMI from height (m) and mass/weight (Kg)
bmicalc <- function(height, mass){
mass/(height)^2 # Mass_kg /(Height_m)^2
}
# Convert inches to centimeters -- multiply by 2.54; centimetrees to meters, divide by 100
feet6inches0_m <- (72 * 2.54)/100 # 6'0" is 72" - Probably a little below Donald Trump's real height
feet6inches3_m <- (75 * 2.54)/100 # 6'3" is 75" - Donald Trumps reported height
# Sequence of 10 heights from 6'0" to 6'3" (in )
h201x <- seq(from=feet6inches0_m, to=feet6inches3_m, length.out=10)
# Donald Trumps reported weight in 2018 and 2019
m2018kg <- 108.41 # 239lbs converted to kg
m2019kg <- 110.229 # 243lbs converted to kg
# Make a data frame of the bmi data for plotting
djtDF <- data.frame(
Year = as.factor(c(rep(2018, 10), rep(2019, 10))),
bmi = c(bmicalc(h201x, m2018), bmicalc(h201x, m2019)),
height = c(h201x, h201x)
)
# Plot the data
ggplot(djtDF, aes(x = height, y = bmi, color = Year)) +
geom_line() +
xlab(expression(Meters^{2})) +
ylab("Body Mass Index") +
geom_hline(yintercept = 30, color = "#990000", linetype="dashed") +
annotate("text", 1.835, 30, vjust = -0.5, label = "Obese") +
geom_vline(xintercept = 1.854, color = "Black", linetype="dashed") +
annotate("text", 1.854, 33, hjust = -0.3, label = "6'1\"") +
geom_vline(xintercept = 1.90, color = "Black", linetype="dashed") +
annotate("text", 1.90, 33, hjust = -0.3, label = "6'3\"")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.