Skip to content
R for the Rest of Us Logo

R in 3 Months Spring 2022 Week 8 Project Assignment

This lesson is locked

Get access to all lessons in this course.

If the video is not playing correctly, you can watch it in a new window

Transcript

Click on the transcript to go to that point in the video. Please note that transcripts are auto generated and may contain minor inaccuracies.

For this week's assignment we're asking you to create a user-defined function to help you write your report. Usually you'll be able to find an example where it would be useful to have a function for making several different charts.

In the video I demonstrate using the United States") %% ggplot(aes(x = year, y = lifeExp)) + geom_line() + labs(title = "United States life expectancy") make_life_exp_plot - function(country_name){ gapminder %% filter(country == country_name) %% ggplot(aes(x = year, y = lifeExp)) + geom_line() + labs(title = country_name) } make_life_exp_plot("Egypt") ">code from this gist.

Have any questions? Put them below and we will help you out!

You need to be signed-in to comment on this post. Login.