I am hoping someone could help please? I am currently doing a course in R and am having trouble with the below exercise. I am brand new to R so know this will be very simple for the majority of you!
I have pasted below what I have typed in in **, but I must be missing something and/or have something wrong, as whenever I go to click to open the spreadsheet, it just looks exactly the same? Can you advise where I am going wrong please?
To access this package, simply install and load gapminder . You can install gapminder, either by clicking on the Packages tab and navigating to the Install shortcut, or by running install.packages("gapminder") in the console. – managed to do this
As usual, we'll also need the tidyverse:
library(gapminder) – managed to do this
library(tidyverse) – managed to do this
Can you create an ordered subset of the gapminder data for the year 2007?-
First:
• create a new object called gap_2007
• gap_2007 <- gapminder, typed into the script window
Then combine two functions from dplyr to:
• filter() the gapminder data to extract only observations from the year 2007
gap_2007 %>%
** filter(year == 2007) %>%**
• arrange() the data to sort it in descending order of life expectancy (lifeExp ).
gap_2007 %>%
** arrange(desc == lifeExp) %>%**
# print out the result
Thank you so much in advance,