# Loop Functions

This page takes an estimated 1 hour to complete.

## Loop Functions in R

Loop functions are some of the most powerful functions in R. They are very easy to use, especially in an interactive setting, and make it possible do to a lot of work while writing less code.

To start learning about loop functions, watch the following videos from Coursera, and return here afterward:

These are the last videos from Coursera in this guide. However, you are encouraged to continue the course and finish it if you so choose.

## swirl Exercises

To practice everything you just learned about loop functions, complete the following swirl lessons:

swirl Lesson 10: lapply and sapply

swirl Lesson 11: vapply and tapply

## R exercises

Use ‘apply’ family functions to get the minimum values of each column of the ‘mtcars’ dataset.

Get a boxplot for each numerical column of the ‘iris’ dataset (four boxplots). Use ‘apply’ family functions

Use ‘apply’ family functions for the “iris” dataset. Divide each column of “iris” by its mean value.

For the ‘mtcars’ dataset create the scatter plot, which will use as an x axis “cyl” column and for the y axis “hp” column. Customize the plot (add title, y and x legend). Is there any relationship between cyl and hp?

For the “iris” dataset create the scatter plot, which will use as an x axis “Petal.Length” column and for the y axis “Sepal.Length” column. Define the type of the relationship between these variables.

For the “iris” dataset create the histogram using “Sepal.Length” variable, change the number of breaks and define the range of “Sepal.Length”, which length occur in the majority of samples.

## Quiz

Next, complete your final Quiz.

## Congratulations!

If you made it here, then congratulations! You have successfully completed this section. Move to the next portion of the guide with the arrow buttons below.

Last updated