Slide 1

Slide 1 text

Teaching computing via visualization mine-cetinkaya-rundel [email protected] @minebocek bit.ly/teach-viz-comp

Slide 2

Slide 2 text

In order to create a data visualization using __________, you first need to learn __________. [software/language] [software/language] bit.ly/teach-viz-comp · @minebocek

Slide 3

Slide 3 text

One way to learn __________, is to create data visualizations using __________. [software/language] [software/language] bit.ly/teach-viz-comp · @minebocek

Slide 4

Slide 4 text

[software/language] bit.ly/teach-viz-comp · @minebocek

Slide 5

Slide 5 text

In which of the following two scenarios do you feel like you have a better handle on the final product? Q bit.ly/teach-viz-comp · @minebocek

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

(a) (b)

Slide 9

Slide 9 text

start with cake 1

Slide 10

Slide 10 text

Which of the following two examples is more likely to be interesting for a wide range of students? Q bit.ly/teach-viz-comp · @minebocek

Slide 11

Slide 11 text

# Declare variables # of different types x !<- 8 y !<- "monkey" z !<- FALSE # Check class of x class(x) #> [1] "numeric" # Check class of y class(y) #> [1] "character" # Check class of z class(z) #> [1] "logical" Declare the following variables Then, determine the class of each variable (a) bit.ly/teach-viz-comp · @minebocek

Slide 12

Slide 12 text

(b) Open today’s example project Knit the document and discuss the results with your neighbor Then, change Turkey to a different country, and plot again bit.ly/teach-viz-comp · @minebocek

Slide 13

Slide 13 text

# Declare variables # of different types x !<- 8 y !<- "monkey" z !<- FALSE # Check class of x class(x) #> [1] "numeric" # Check class of y class(y) #> [1] "character" # Check class of z class(z) #> [1] "logical" (a) (b) bit.ly/teach-viz-comp · @minebocek

Slide 14

Slide 14 text

with great examples, comes a great amount of code… bit.ly/teach-viz-comp · @minebocek

Slide 15

Slide 15 text

but let’s focus on the task at hand… Open today’s example project Knit the document and discuss the results with your neighbor Then, change Turkey to a different country, and plot again bit.ly/teach-viz-comp · @minebocek

Slide 16

Slide 16 text

bit.ly/teach-viz-comp · @minebocek un_votes %>% filter(country %in% c("United States of America", "Turkey")) %>% inner_join(un_roll_calls, by = "rcid") %>% inner_join(un_roll_call_issues, by = "rcid") %>% group_by(country, year = year(date), issue) %>% summarize( votes = n(), percent_yes = mean(vote !== "yes") ) %>% filter(votes > 5) %>% # only use records where there are more than 5 votes ggplot(mapping = aes(x = year, y = percent_yes, color = country)) + geom_point() + geom_smooth(method = "loess", se = FALSE) + facet_wrap(~ issue) + labs( title = "Percentage of 'Yes' votes in the UN General Assembly", subtitle = "1946 to 2015", y = "% Yes", x = "Year", color = "Country" )

Slide 17

Slide 17 text

bit.ly/teach-viz-comp · @minebocek un_votes %>% filter(country %in% c("United States of America", "Turkey")) %>% inner_join(un_roll_calls, by = "rcid") %>% inner_join(un_roll_call_issues, by = "rcid") %>% group_by(country, year = year(date), issue) %>% summarize( votes = n(), percent_yes = mean(vote !== "yes") ) %>% filter(votes > 5) %>% # only use records where there are more than 5 votes ggplot(mapping = aes(x = year, y = percent_yes, color = country)) + geom_point() + geom_smooth(method = "loess", se = FALSE) + facet_wrap(~ issue) + labs( title = "Percentage of 'Yes' votes in the UN General Assembly", subtitle = "1946 to 2015", y = "% Yes", x = "Year", color = "Country" )

Slide 18

Slide 18 text

bit.ly/teach-viz-comp · @minebocek

Slide 19

Slide 19 text

Source: edx.org/course/introduction-r-data-science-1 bit.ly/teach-viz-comp · @minebocek

Slide 20

Slide 20 text

Source: www.coursera.org/specializations/jhu-data-science#courses bit.ly/teach-viz-comp · @minebocek

Slide 21

Slide 21 text

Source: datasciencebox.org/hello/topics Making rigorous conclusions Looking forward Fundamentals of data & data viz, revision exercises, confounding variables and Simpson’s paradox Rmd + Git + GitHub Tidy data, data frames vs. summary tables, recoding and transforming variables, web scraping and iteration Building and selecting models, visualizing interactions, prediction and model validity, inference via simulation & discussion of CLT Interactive visualization and reporting, Bayesian inference, text analysis, … Exploring data Visualize Wrangle bit.ly/teach-viz-comp · @minebocek

Slide 22

Slide 22 text

skip baby steps 2

Slide 23

Slide 23 text

Which of the following two visualizations is more likely to be motivating for a wide range of students? Q bit.ly/teach-viz-comp · @minebocek

Slide 24

Slide 24 text

ggplot(data = un_roll_calls, mapping = aes(x = amend)) + geom_bar() (a) bit.ly/teach-viz-comp · @minebocek

Slide 25

Slide 25 text

ggplot(data = un_votes_joined, mapping = aes(x = year, y = percent_yes, color = country)) + geom_point() + geom_smooth(method = "loess", se = FALSE) + facet_wrap(~ issue) + labs( title = "Percentage of 'Yes' votes in the UN General Assembly", subtitle = "1946 to 2015", y = "% Yes", x = "Year", color = "Country" ) (b) bit.ly/teach-viz-comp · @minebocek

Slide 26

Slide 26 text

(a) (b) bit.ly/teach-viz-comp · @minebocek

Slide 27

Slide 27 text

non-trivial examples can be motivating, but need to avoid ! bit.ly/teach-viz-comp · @minebocek

Slide 28

Slide 28 text

ggplot(data = un_votes_joined, mapping = aes(x = year, y = percent_yes)) bit.ly/teach-viz-comp · @minebocek

Slide 29

Slide 29 text

ggplot(data = un_votes_joined, mapping = aes(x = year, y = percent_yes)) bit.ly/teach-viz-comp · @minebocek function( arguments ) often a verb what to apply that Verb to

Slide 30

Slide 30 text

ggplot(data = un_votes_joined, mapping = aes(x = year, y = percent_yes)) bit.ly/teach-viz-comp · @minebocek rows = observations columns = variables “tidy” data frame

Slide 31

Slide 31 text

ggplot(data = un_votes_joined, mapping = aes(x = year, y = percent_yes)) + geom_point() bit.ly/teach-viz-comp · @minebocek

Slide 32

Slide 32 text

ggplot(data = un_votes_joined, mapping = aes(x = year, y = percent_yes, color = country)) + geom_point() bit.ly/teach-viz-comp · @minebocek

Slide 33

Slide 33 text

ggplot(data = un_votes_joined, mapping = aes(x = year, y = percent_yes, color = country)) + geom_point() + geom_smooth(method = "loess", se = FALSE) bit.ly/teach-viz-comp · @minebocek

Slide 34

Slide 34 text

ggplot(data = un_votes_joined, mapping = aes(x = year, y = percent_yes, color = country)) + geom_point() + geom_smooth(method = "loess", se = FALSE) + facet_wrap(~ issue) bit.ly/teach-viz-comp · @minebocek

Slide 35

Slide 35 text

ggplot(data = un_votes_joined, mapping = aes(x = year, y = percent_yes, color = country)) + geom_point() + geom_smooth(method = "loess", se = FALSE) + facet_wrap(~ issue) + labs( title = "Percentage of 'Yes' votes in the UN General Assembly", subtitle = "1946 to 2015", y = "% Yes", x = "Year", color = "Country" ) bit.ly/teach-viz-comp · @minebocek

Slide 36

Slide 36 text

cherish day one 3

Slide 37

Slide 37 text

Which of the following two tasks is more likely to be welcoming for a wide range of students? Q bit.ly/teach-viz-comp · @minebocek

Slide 38

Slide 38 text

(a) Install R Install RStudio Install the following packages: tidyverse rmarkdown … Load these packages Install git (b) Go to vm- manage.oit.duke.edu or rstudio.cloud (or some other server based solution) Log in with your ID & pass > hello R! bit.ly/teach-viz-comp · @minebocek

Slide 39

Slide 39 text

method of delivery, and medium of interaction matters bit.ly/teach-viz-comp · @minebocek

Slide 40

Slide 40 text

→ → → → bit.ly/teach-viz-comp · @minebocek

Slide 41

Slide 41 text

tl;dr bit.ly/teach-viz-comp · @minebocek

Slide 42

Slide 42 text

1 2 3 start with cake skip baby steps cherish day one

Slide 43

Slide 43 text

Why = ? Q bit.ly/teach-viz-comp · @minebocek

Slide 44

Slide 44 text

Let them eat cake (first)! You can tell them all about the ingredients later… mine-cetinkaya-rundel [email protected] @minebocek bit.ly/teach-viz-comp