🤷♂️
This file contains hidden or 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
setwd("~/Dropbox/data/gss/GSS_spss-2018") | |
library(tidyverse) | |
# haven::read_sav method ----- | |
# ---------------------------- | |
readsav_times = data.frame() | |
for(i in 1:10) { |
This file contains hidden or 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
user.self | sys.self | elapsed | user.child | sys.child | Method | Category | |
---|---|---|---|---|---|---|---|
20.027000000000044 | 0.9840000000000018 | 21.006000000000085 | 0 | 0 | base::readRDS | Read Times | |
17.839999999999918 | 0.847999999999999 | 18.68399999999997 | 0 | 0 | base::readRDS | Read Times | |
18.113000000000056 | 0.5360000000000014 | 18.643999999999778 | 0 | 0 | base::readRDS | Read Times | |
18.394000000000005 | 0.3640000000000043 | 18.75299999999993 | 0 | 0 | base::readRDS | Read Times | |
19.273999999999887 | 0.015999999999998238 | 19.284000000000106 | 0 | 0 | base::readRDS | Read Times | |
19.51299999999992 | 0.2079999999999984 | 19.715000000000146 | 0 | 0 | base::readRDS | Read Times | |
19.71699999999987 | 0.6000000000000014 | 20.311999999999898 | 0 | 0 | base::readRDS | Read Times | |
19.740999999999985 | 0.5080000000000027 | 20.242999999999938 | 0 | 0 | base::readRDS | Read Times | |
19.47199999999998 | 0.5960000000000036 | 20.063000000000102 | 0 | 0 | base::readRDS | Read Times |
This file contains hidden or 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
library(pwt9) | |
library(tidyverse) | |
library(stevemisc) | |
pwt9.1 %>% tbl_df() -> pwt | |
pwt %>% | |
filter(country %in% c("Germany", "United Kingdom", "France", | |
"Mexico", "Brazil", "Argentina", |
This file contains hidden or 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
rivalryno | rivalryname | sidea | sideb | styear | endyear | region | type1 | type2 | type3 | |
---|---|---|---|---|---|---|---|---|---|---|
1 | Austria-France | Austria | France | 1494 | 1918 | European GPs | spatial | positional | ||
2 | Austria-Ottoman Empire | Austria | Ottoman Empire | 1494 | 1908 | European GPs | spatial | positional | ||
4 | France-Spain | France | Spain | 1494 | 1700 | European GPs | positional | spatial | ||
3 | Britain-France 1 | Great Britain | France | 1494 | 1716 | European GPs | spatial | positional | ||
5 | Ottoman Empire-Spain | Ottoman Empire | Spain | 1494 | 1585 | European GPs | spatial | positional | ||
6 | Ottoman Empire-Venice | Ottoman Empire | Venice | 1494 | 1717 | European GPs | spatial | positional | ||
7 | Portugal-Spain | Portugal | Spain | 1494 | 1580 | European GPs | spatial | positional | ||
8 | Portugal-Venice | Portugal | Venice | 1494 | 1580 | European GPs | positional | |||
9 | Ottoman Empire-Portugal | Ottoman Empire | Portugal | 1501 | 1580 | European GPs | positional |
This file contains hidden or 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
library(tidyverse) | |
library(stevemisc) | |
GSS <- readRDS("~/Dropbox/data/gss/GSS_spss-2018/gss7218.rds") | |
GSS %>% | |
mutate(regioncondensed = NA, | |
regioncondensed = ifelse(region == 8 | region == 9, "West", regioncondensed), | |
regioncondensed = ifelse(region == 3 | region == 4, "Midwest", regioncondensed), | |
regioncondensed = ifelse(region == 5 | region == 6 | region == 7, "South", regioncondensed), |
This file contains hidden or 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
library(stevemisc) | |
library(tidyverse) | |
options(mc.cores=parallel::detectCores()) | |
data(uniondensity) | |
M1 <- lm(union ~ left + size + concen, data=uniondensity) | |
library(brms) |
This file contains hidden or 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
library(fredr) | |
library(stevemisc) | |
library(lubridate) | |
Approv <- read_csv("~/Dropbox/data/potus-approval/potus-approval-monthly-average.csv") | |
fredr(series_id = "CPALTT01USM659N", | |
observation_start = as.Date("1968-01-01"), | |
observation_end = as.Date("1981-01-01")) -> cpi_nixon |
This file contains hidden or 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
library(tidyverse) | |
library(stevemisc) | |
GSS <- readRDS("~/Dropbox/data/gss/GSS_spss-2018/gss7218.rds") | |
GSS %>% | |
select(year, cat, dog, partyid, polviews) %>% | |
filter(year == 2018) %>% | |
mutate(catnodog = ifelse(cat == 1 & dog == 0, 1, 0), | |
dognocat = ifelse(dog == 1 & cat == 0, 1, 0), | |
nodognocat = ifelse(cat == 0 & dog == 0, 1, 0), |
This file contains hidden or 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
library(blscrapeR) | |
library(tidyverse) | |
library(stevemisc) | |
bls_api(c("CUSR0000SS30021", # laundry equipment | |
"CUSR0000SEHK02", # other appliances | |
"CUSR0000SEHJ", # furniture and bedding | |
"CUSR0000SETC", # motor vehicle parts | |
"CUUR0000SEHH01", # floor coverings (NSA) | |
"CUSR0000SERC01", # sports vehicles (including bicycles) |
This file contains hidden or 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
library(tidyverse) | |
CCES <- haven::read_dta("~/Dropbox/data/cces/2018/CCES2018_OUTPUT.dta") %>% | |
rename_all(tolower) | |
CCES %>% # don't forget to collect educ | |
mutate(agenum = 2018 - birthyr, | |
sex = ifelse(gender == 2, "Female", "Male"), | |
pid = ifelse(pid7 %in% c(1,2,3), "Democrat", NA), | |
pid = ifelse(pid7 %in% c(5,6,7), "Republican", pid), | |
pid = ifelse(pid7 %in% c(4,8,9,98,99), "Independent", pid), |