Skip to content

Commit

Permalink
hw 2
Browse files Browse the repository at this point in the history
  • Loading branch information
clauswilke committed Jan 22, 2024
1 parent 798cbf3 commit 010e666
Show file tree
Hide file tree
Showing 63 changed files with 15,539 additions and 15,127 deletions.
50 changes: 50 additions & 0 deletions docs/assignments/HW2.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
title: "Homework 2"
---

```{r global_options, include=FALSE}
library(knitr)
library(tidyverse)
opts_chunk$set(fig.align="center", fig.height=4, fig.width=5.5)
# data prep:
txhouse <- txhousing %>%
filter(city %in% c('Austin', 'Houston', 'San Antonio', 'Dallas')) %>%
filter(year %in% c('2000', '2005', '2010', '2015')) %>%
group_by(city, year) %>%
summarize(total_sales = sum(sales))
```

**This homework is due on Feb. 1, 2024 at 11:00pm. Please submit as a pdf file on Canvas.**

**Problem 1: (6 pts)** For this Problem you will be working with the `iris` dataset built into R. This data set contains measurements of flowers (sepal length, sepal width, petal length, petal width) for three different *Iris* species (*I. setosa*, *I. versicolor*, *I. virginica*).

```{r}
head(iris)
```

Use ggplot to make a histogram of the `Sepal.Length` column. Manually choose appropriate values for `binwidth` and `center`. Explain your choice of values in 2-3 sentences.

```{r}
# Your code goes here.
```

*Your explanation goes here.*

**Problem 2: (6 pts)** For this problem you will work with the dataset `txhouse` that has been derived from the `txhousing` dataset provided by **ggplot2**. See here for details of the original dataset: https://ggplot2.tidyverse.org/reference/txhousing.html. `txhouse` contains three columns: `city` (listing four Texas cities), `year` (containing four years between 2000 and 2015) and `total_sales` indicating the total number of sales for the specified year and city.

```{r}
txhouse
```

Use ggplot to make a bar plot of the total housing sales (column `total_sales`) for each `year`, color the bar borders "gray34", and fill the bars by `city`.

```{r}
# Your code goes here.
```

**Problem 3: (8 pts)** Modify the plot from Problem 2 by placing `city` bars side-by-side, rather than stacked. See Slide 35 from the lecture on visualizing amounts. Next, reorder the bars for each `year` by `total_sales` in descending order. See Slide 25 from the lecture on visualizing amounts.

```{r}
# Your code goes here.
```
462 changes: 462 additions & 0 deletions docs/assignments/HW2.html

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion docs/schedule.html
Original file line number Diff line number Diff line change
Expand Up @@ -2610,7 +2610,8 @@ <h3 id="homework-2-due-feb-1-2024">Homework 2 (due Feb 1, 2024)</h3>
Materials:
</p>
<ul>
<li>coming soon</li>
<li><a href="assignments/HW2.Rmd">R Markdown template</a></li>
<li><a href="assignments/HW2.html">HTML</a></li>
</ul>
<h3 id="homework-3-due-feb-8-2024">Homework 3 (due Feb 8, 2024)</h3>
<h3 id="homework-4-due-feb-29-2024">Homework 4 (due Feb 29, 2024)</h3>
Expand Down
10 changes: 5 additions & 5 deletions docs/search.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/slides/coordinate-systems-axes.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
### Claus O. Wilke
]
.date[
### last updated: 2023-01-19
### last updated: 2024-01-22
]

---
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,619 changes: 808 additions & 811 deletions docs/slides/coordinate-systems-axes_files/figure-html/texas-counties-log-1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

272 changes: 136 additions & 136 deletions docs/slides/telling-a-story_files/figure-html/preprints-part1-1.svg

Large diffs are not rendered by default.

294 changes: 147 additions & 147 deletions docs/slides/telling-a-story_files/figure-html/preprints-part2-1.svg

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

282 changes: 141 additions & 141 deletions docs/slides/visualizing-amounts_files/figure-html/boxoffice-dotplot-1.svg

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

0 comments on commit 010e666

Please sign in to comment.