Functions

for Loop


This is a follow up to Nested Functions.

Now that you’ve impressed Grandma, it’s time to do some serious science. Take the following vector of Stegosaur lengths

lengths <- c(10.1, 9.5, 11.2, 9.8, 10.4, 12.0, 11.5, 9.5, 9.8,
10.0, 10.7, 10.2, 11.9, 9.7, 11.2, 11.8, 10.7)

and estimate the mass in kilograms for each length using a for loop, your function for estimating mass, a = 10.95, and b = 2.64. Print the results in order.

[click here for output]