# R Baby Height Predictor

Not surprisingly, parents are interested in knowing what their future children will be like. One topic of interest is how tall their child will be as an adult. As you might expect, height is somewhat predictable. You can predict a child’s adult height with the parents’ heights and the baby’s gender. See http://www.mayoclinic.org/child-growth/expert-answers/faq-20057990 for more detail.

Once the baby is born you can do more accurate predictions using lookup tables but that’s beyond the scope of this post.

```# What gender is the baby? Enter M or F.
gender <- "M"```
```# How tall is the mother in inches? Enter a number.
mother <- 64.5```
```# How tall is the father in inches? Enter a number.
father <- 70```
```# Use an if statement to create a correction of 5 if gender is male and
# -5 if gender is -5
if(gender=="M") correction <- 5 else
correction <- -5```
```# Calculate height by adding the mother's height, the father's height and
# the correction factor
height <- (mother + father + correction) / 2```
```# Create values that the user will understand
feet <- trunc(height / 12)
inches <- round(height - feet * 12, 0)```
```# Let the user know how tall their baby will be