Warning: There was 1 warning in `mutate()`.
ℹ In argument: `height = as.numeric(height)`.
Caused by warning:
! NAs introduced by coercion
height_plot =ggplot(clean_height, aes(x = time_stamp, y = height, color = sex, text = sex)) +geom_point(size =2.4, alpha =0.5) +labs (title ="Comparison of Self-Reported Height between Males and Females", x ="Year Reported (2014 - 2017)", y ="Height (in inches)", caption ="Dataset sourced from DS Labs" ) +theme_minimal(base_size =10, base_family ="mono") +scale_color_manual(values =c("pink", "darkblue"))height_plot
inter =ggplotly(height_plot)inter
I utilized the reported_height dataset included in the “dslabs” package. The dataset included the following variables:
Time_stamp: the exact date and time in which the height was self-reported.
Sex: gender of the reported (either male or female)
Height: the actual self-reported height.
The height entries varied, as they were self-reported. Some reported using feet and inches, some only in inches, some fully spelled out. Since the data varied, I needed to clean it first utilizing the filter and str_detect functions. I then mutated it into numerical data and filtered it once again to only include heights above 50 and below 85 inches. I created my graph using the time_stamps as my x axis, and height as my y-axis. I utilized geom_point() and colored the points by sex. I then made the graph interactive employing ggplotly to allow the time stamp, sex, and height of each point to appear when hovering over the point. I found it interesting how majority of men reported their heights around 70 inches (5’8 ft), whereas many women reported their heights to be around 60 inches (5ft).