-
Notifications
You must be signed in to change notification settings - Fork 0
/
3-starwars_opinions.Rmd
executable file
·145 lines (69 loc) · 2.14 KB
/
3-starwars_opinions.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
---
title: "Star Wars Opinion Data"
author: "Angela Zoss"
date: "9/7/2018"
output: html_document
---
## Setup your environment
```{r}
# Load required libraries
library(tidyverse)
```
## Load your data
```{r}
# data from https://fivethirtyeight.com/features/americas-favorite-star-wars-movies-and-least-favorite-characters/
# note: CSV has two rows of headers, so I have manually created a list of headers and am adding
# that after loading just the data rows
new_names <- read_csv('data/StarWarsNames.csv') %>% select(NewNames)
starwars_opins <- read_csv('data/StarWars.csv', skip=2, col_names=FALSE) %>% setNames(unlist(new_names))
```
## Plot the opinions for Hans Solo
```{r}
# hint: there is a geom that will take a categorical variable and count the data points in
# each category
# also: feel free to remove NAs
```
## Plot the opinions for Jar Jar Binks
```{r}
```
## Edit the axes of each of these charts to make them comparable
```{r}
# remember, editing an axis usually requires a scale
```
## Advanced: can you think of another way to standardize the axes?
```{r}
```
## Reorder the opinion levels so they are in a logical order
```{r}
opinion.levels <- c("Unfamiliar (N/A)","Very unfavorably","Somewhat unfavorably",
"Neither favorably nor unfavorably (neutral)",
"Somewhat favorably","Very favorably")
```
## Flip the axes so the opinion levels are on the y-axis
```{r}
```
## Use a different color for each opinion level
```{r}
```
## Customize the color palette
```{r}
# hint: editing colors requires a change of scale
# can google "R colors" for a list of all named colors
```
## What percentage of survey participants responded "No" to "SeenAnyYN"?
```{r}
# start with a bar chart
```
```{r}
# change it to a stacked bar chart, where the answers are different colors
# hint: there will only be one bar, so x will no longer be tied to a variable
```
```{r}
# change the coordinate system to polar with theta="y"
```
## Advanced 1: Compare this pattern across genders
```{r}
```
## Advanced 2: Calculate percentage and add as a label, simplify theme
```{r}
```