Exercises - Programming

  1. Write a 'for' loop to print the values 1 to 10.

  2. Write a 'for' loop to print Celsius degrees in Fahrenheit for the degrees 25 to 32 (using the function you created in the functions exercises).

  3. Write a loop to calculate the Simpson index for each transect in the vegetation data (using the function you created in the functions exercises).

  4. Then do the same calculation using the 'apply' function in R instead of a loop.