Chat with us, powered by LiveChat Relations among Categorical Variables In the notes on Healy’s Chapter 5, we looked at several ways to visualize the relations | EssayAbode

## 26 Nov Relations among Categorical Variables In the notes on Healy’s Chapter 5, we looked at several ways to visualize the relations

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}

“`

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.