Question: R coding In class, we created a mosaic plot of smoking status for each level of exercise in the `survey` dataset in the `MASS` package.

R coding

In class, we created a mosaic plot of smoking status for each level of exercise in the `survey` dataset in the `MASS` package. The bars and the categories for each bar were not in logical order, but rather alphabetical order. Recreate the mosaic plot putting the levels of smoking status and exercise in a logical order. In order to do this, re-code the values of the variables with numbers and then make the mosaic plot again with the re-coded variables. You can leave the mosaic plot labeled with numbers, but explain in text below your plot what the number codings represent.

First, we will remove row 70 of the dataset since that observation has a missing value for smoking status:

```{r} library(MASS) surveydata = survey[-70,]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!