Publications by Tyler Simko

Lesson 1: The Basics of R

18.06.2021

1. Data Throughout this entire course, you will use code to do things with data. R can deal with many types of data, like numbers (3, 0, 2021), letters and words called characters (“Data”, “South Amboy”, “Tyler”), and many many others. For example, go to your console (the panel called “Console” with the > character at the bottom) ...

5879 sym R (859 sym/51 pcs)

Lesson 2: Datasets

18.06.2021

In Lesson 1, we learned about objects. Vectors are objects with multiple values. For example, you could have vectors that tell you the population and year for a particular area. Like this: pop <- c(100, 347, 500) year <- c(2019, 2020, 2021) You can type the name of the object to see these values and also use functions on them just like before: po...

5786 sym R (3723 sym/31 pcs)

Lesson 3: Data Visualization

18.06.2021

1. Building a plot Looking at a dataset is nice, but we will often want to visualize our data. R has incredibly powerful tools for data visualization. To start, load the tidyverse library and read the presidential elections data from yesterday1 and take a look at it to remind yourself: library(tidyverse) elections <- read_csv("pres_elections.csv"...

7056 sym R (4602 sym/37 pcs) 28 img

Lesson 6: Practice and Advanced Plotting

22.06.2021

We have already covered a lot! Let’s take a step back and review everything that we have learned so far. This is based very closely on a practice exam I gave to my Harvard students in Fall 2020. We will use data from the College Scorecard, a public dataset from the US Department of Education that contains information about colleges and universi...

6990 sym R (3304 sym/15 pcs) 6 img 1 tbl

Gov 50 - Additional Exercises

19.01.2022

Create an object called population with the value 412,367. Make a second object called births, assign it the value 3012. Then add the two together. Go into the console and type ?abs to open the documentation for the abs() function. Come up with an example that shows what it does. The function sum() will add all the values in a vector. Run ?sum to...

524 sym

Gov50 — Lesson 2: Studying with RMarkdown

16.01.2022

Creating a place to store your code First, we’ll start by making a new folder for your course material like we just discussed. Make a new folder somewhere in your Documents folder called something like “Gov50” or “gov_50” (remember – no spaces!): PC: Open your "Computer" -> "Documents" -> Right click -> "New" -> "Folder" Mac: Open "F...

2123 sym 5 img

Gov50 — Lesson 1: Setting up

14.01.2022

For Gov 50, you will need to install some free and safe software. This document will walk you through installing the tools we will be using in this course. Installing R First, we will install a programming language called R. This is the tool we will be using throughout the course to analyze data and make plots. R is a programming language that w...

5200 sym R (428 sym/4 pcs) 12 img

Tutorial: Working with Census Data in R

02.11.2021

Data from the US Census Bureau can be invaluable resources for doing research. The enormous scale of Census data (both breadth over time and depth from options!) can be overwhelming, so this tutorial is intended to guide students to using Census Data in R. Although it is possible to manually download data from the Census (if you would prefer to d...

9837 sym R (3657 sym/11 pcs) 6 img

Gov 50 - Notes on Chapter 1

19.01.2022

1. Data R can deal with many types of data, like numbers (3, 0, 2021), letters and words called characters (“Data”, “Gov 50”, “Professor Lo”), and many many others. For example, in the grey box below this message surrounded by the “`” character, type 3 and press the green arrow (or CMD + Enter on a Mac / Ctrl + Enter on PC): 3 ## ...

5314 sym R (729 sym/56 pcs)

Gov 50: Notes on Chapter 2

29.01.2022

cup <- read.csv("worldcup50.csv") Useful functions dim(cup) ## [1] 13 12 head(cup) ## X year team scored conceded penalties matches shots_on_goal won drawn ## 1 1 1950 Brazil 22 6 0 6 22 4 1 ## 2 2 1950 Uruguay 15 5 0 4 15 3 1 ## 3 3 1950 Swede...

79 sym R (3999 sym/29 pcs)