---

title: "Assignment 1"

output: word_document

---


## Relations among Categorical Variables

In the notes on Healy's Chapter 5, we looked at several ways to visualize the relationship between two categorical variables.


For this assignment you need to select a pair of cateogrical variables from a dataset which interests you. You could use one of the datasets I used in class, but you are free to pick anything.


## Problem 1

Identify the dataset you've chosen and the two categorical variables. Feel free to create a new categorical variable from an existing quantitative variable. Do a summary of the dataset and produce simple tables for each of the two variables. Make sure that you don't have too many values. Collapse if necessary.


Don't forget to include library commands for all of the packages you need.


```{r}

# Place your code in this chunk.

glimpse(organdata)


## Problem 2


Select the visualization of the relationship that you feel is the best and produce it.


```{r}

# Place your code here.

```

library(ggplot2)

p <- ggplot(data = organdata,

            mapping = aes(x = reorder(country, donors, na.rm=TRUE),

                          y = donors))

p + geom_bar() +

  labs(x=NULL) +

  coord_flip()



## Problem 3

What is your second-choice visualization? Don't forget to explain why you prefer the first choice over the second choice.



```{r}

# Place your code in this chunk.

```

library(ggplot2)

p <- ggplot(data = organdata,

            mapping = aes(x = reorder(country, donors, na.rm=TRUE),

                          y = donors))

p + geom_boxplot() +

  labs(x=NULL) +

  coord_flip()


I prefer the first visualization to the second one because it is easier to read and interpret the relationship between data



## Problem 4


Based on your visualizations describe what you see. Assume that you are speaking to a blind person.


Just write your comments here.


With the selected visualization, we can tell the level of organ donations in different countries. Since the visualization for every country is placed side by side, comparison of how organs have been donated across different countries becomes easiert.



    • 6 days ago
    answer
    NOT RATED

    Purchase the answer to view it

    blurred-text