Fall 2023 Exam 2 ACCT 426 / BUDA 451

Your name here: Bryce Kunschick #############################################################################

Question 1 (30%)

Fix the typos below.

The section should: Load data from the url below.

Make a tibble called t_sales with the following columns. Match the titles exactly game price (if needed, use parse_double to turn from text into a number) condition (a factor, use factor_levels to get them in the right order) d (a date column that you created)

Be sure to remove any fields where price is equal to #VALUE!

## # A tibble: 653 × 8
##    game            `Item ID` `Sale Month` `Sale Day` `Sale Year` price condition
##    <chr>           <chr>            <dbl>      <dbl>       <dbl> <dbl> <chr>    
##  1 Terraforming M… 1841104              7         28        2023  47.2 Like New 
##  2 Terraforming M… 1840999              7         28        2023 100   New      
##  3 Terraforming M… 1836648              7          5        2023  50   Very Good
##  4 Terraforming M… 1834501              6         26        2023  50   Very Good
##  5 Terraforming M… 1833240              6         20        2023  50   Very Good
##  6 Terraforming M… 1827317              5         30        2023 150   Good     
##  7 Terraforming M… 1822436              5         11        2023  25   Very Good
##  8 Terraforming M… 1819157              4         30        2023  20   Acceptab…
##  9 Terraforming M… 1817569              4         24        2023  55   Very Good
## 10 Terraforming M… 1816982              4         21        2023  45   Like New 
## # ℹ 643 more rows
## # ℹ 1 more variable: d <date>

Question 2: 40%

Create the graph with these steps:

t_q2 <- t_sales_3 %>% 
  filter(game == 'Terraforming Mars' | game == 'Pandemic')

ggplot(data = t_q2) +
  geom_point(mapping = aes(x = d, y = price,
                           color = game)) +
  labs(title = "Sale trends for Pandemic and Terraforming Mars") +
  xlab("Date") +
  ylab("Price") +
  scale_y_continuous(labels = scales::label_dollar(),
                     breaks = c(0, 50, 100),
                     limits = c(0,100))
## Warning: Removed 10 rows containing missing values (`geom_point()`).

  ##scale_x_datetime(date_breaks = '6 months') -- didn't work :(

Question 3: 30%

Create your own chart for Gloomhaven

Show how sales price varies by condition in a chart.

Add some polish with a title and a custom scale.

t_q3 <- t_sales_3 %>% 
  group_by(condition) %>% 
  summarize(median_price = median(price))

ggplot(data = t_q3) +
  geom_col(mapping = aes(x = condition, y = median_price,
                         fill = condition)) +
  labs(title = "Median Price by Condition") +
  xlab("Condition") +
  ylab("Price") +
  scale_y_continuous(labels = scales::label_dollar(accuracy = 1),
                     breaks = c(0, 25, 50, 75, 100),
                     limits = c(0, 85))