generated from berkeley-cdss/course-site-quarto
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
41 changed files
with
28 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
f0eb44d4 | ||
ff7d4a77 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
library(tidyr) | ||
tmp <- read.csv('life_exp.csv') %>% pivot_longer(c(starts_with(c('le','sd')))) %>% | ||
separate(name, into = c('type','sex','education'), sep = "_") | ||
|
||
## Hacky: this manipulation to get separate columns for life expectancy and sd | ||
## could be done more elegantly. | ||
data <- tmp[tmp$type == 'le', ] | ||
sd <- tmp[tmp$type == 'sd', ] | ||
|
||
names(data)[5] <- 'lifeexp' | ||
data$sd <- sd$value | ||
|
||
plot(data$lifeexp, data$sd) | ||
|
||
## Some different ways to display the relationships. | ||
|
||
library(ggplot2) | ||
|
||
ggplot(data, aes(x = lifeexp, y = sd)) + geom_point() + facet_wrap(~country) | ||
ggplot(data, aes(x = lifeexp, y = sd)) + geom_point(aes(color = sex, shape = education)) + facet_wrap(~country) | ||
|
||
ggplot(data, aes(x = lifeexp, y = sd)) + geom_point(aes(color = education)) + facet_wrap(~sex) | ||
|
||
ggplot(data, aes(x = lifeexp, y = sd)) + geom_point(aes(color = sex)) + facet_wrap(~education) | ||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file modified
BIN
-593 Bytes
(98%)
units/unit12-graphics_files/figure-html/unnamed-chunk-10-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+5.35 KB
(130%)
units/unit12-graphics_files/figure-html/unnamed-chunk-3-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+6.71 KB
(110%)
units/unit12-graphics_files/figure-html/unnamed-chunk-6-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-10.7 KB
(96%)
units/unit12-graphics_files/figure-html/unnamed-chunk-7-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2.16 KB
(96%)
units/unit12-graphics_files/figure-html/unnamed-chunk-8-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.