For this exercise, you will need to use the package `mosaic` to find numerical and graphical...

50.1K

Verified Solution

Question

Basic Math

For this exercise, you will need to use the package `mosaic` tofind numerical and graphical summaries.

```{r warning=FALSE, message=FALSE}
# install packages if necessary
if (!require(mosaic)) install.packages(`mosaic`)
if (!require(dplyr)) install.packages(`dplyr`)
if (!require(gapminder)) install.packages(`gapminder`)
# load the package in R
library(mosaic) # load the package mosaic to use itsfunctions
library(dplyr) # load the package dplyr to use its functions
library(gapminder) # load the package gapminder for question1
```


1. Using the gapminder data in the lesson, do the following:
i) use `filter` to select all countries with the followingarguments:
a) life expectancy larger than 60 years.   
b) United Kingdom and Vietnam and years greater than 1990.
ii) use `arrange` and `slice` to select the countries with the top15 GDP per capital `gdpPercap`. Use the pipe `%>%` operator tostring multiple functions.
iii) use `mutate` to create a new variable called`gdpPercap_lifeExp` which is the quotient of `gdpPercap` and`lifeExp` and display the output.
iv) use `summarise` to find the average or mean value of thevariable `gdpPercap_lifeExp` created in part (iii).  
v) use `group_by` to group the countries by `continent`; and`summarise` to compute the average life expectancy `lifeExp` withineach continent. Use the pipe `%>%` operator to string multiplefunctions.
  
  

### Code chunk
```{r}
# load the necessary packages
library(mosaic)
library(dplyr)
library(gapminder)

# last R code line
```

Answer & Explanation Solved by verified expert
4.4 Ratings (753 Votes)
The    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students