Step 1: Calculating means

#1) Compute, using R, the average height (called mean in R)
mean(height)

## [1] 63.85714

#2) Compute, using R, the average weight (called mean in R)
mean(weight)

## [1] 160

#3) Calculate the length of the vector "height" and "weight"
length(height)

## [1] 7

length(weight)

## [1] 7

#4) Calculate the sum of the heights
sum(height)

## [1] 447

#5) Compute the average of both height and weight, by dividing the sum (of the height or the width, as appropriate), by the length of the vector. How does this compare to the ‘mean’ function?
sum(height)/length(height)

## [1] 63.85714

sum(weight)/length(weight)

## [1] 160

Step 2: Using max/min functions

Step 3: Vector Math

#8) Create a new vector, which is the weight + 5 (every person gained 5 pounds)
newWeight <- weight + 5
#9) Compute the weight/height for each person, using the new weight just created
newWeight/height

## [1] 2.627119 2.416667 3.032787 3.879310 2.462687 2.013889 1.928571

Step 4: Using Conditional if statements

Hint: In R, one can do: if ( 100 < 150 ) “100 is less than 150” else “100 is greater than 150”