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
setwd("...") | |
library(ggplot2) | |
## DATA: Ron Francisco's European Protest and Coercion Data. | |
## Downloaded (.xls files) from http://web.ku.edu/~ronfrand/data/ and converted into .csv with MS Excel. | |
# Defining main dataframe and specifying country codes | |
data = data.frame(date = c(), action = c(), freq = c(), country = c()) | |
countrycodes = c("Albania80-88", "Albania89-95", "Austria80-95", "Belgium80-87", "Belgium88-95", |
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
# ============================== # | |
# MACIS - Methods II # | |
# Homework 1 - May 1, 2015 # | |
# ------------------ # | |
# Francisco Villamil # | |
# ============================== # | |
setwd("...") | |
lapply(c("rms", "lme4", "ggplot2", "foreign", "aod"), |
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
# ===================================== # | |
# MACIS - Methods II # | |
# Homework 2 - May 15, 2015 # | |
# -------- # | |
# Francisco Villamil # | |
# ===================================== # | |
setwd("~/Dropbox/MACIS/Methods\ II/hw2") | |
lapply(c("foreign", "ggplot2", "MASS", "VGAM", "boot"), |
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
setwd("~") | |
library(rvest) | |
library(stringr) | |
# --------------- | |
# FUNCTIONS | |
prov_code_to_name = function(x){ | |
p = c("alava", "albacete", "alicante", "almeria", "avila", | |
"badajoz", "baleares", "barcelona", "burgos", "caceres", |
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
rm(list = ls()) | |
setwd("~/Documents/Academic/courses/SocDataScience_feb19/project") | |
library(rvest) | |
library(stringr) | |
library(dplyr) | |
options(stringsAsFactors = FALSE) | |
url_list = c("https://www.tripadvisor.com/Restaurants-g187514-Madrid.html", | |
"https://www.tripadvisor.com/Restaurants-g187497-Barcelona_Catalonia.html", | |
"https://www.tripadvisor.com/Restaurants-g187454-Bilbao_Province_of_Vizcaya_Basque_Country.html", |
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
# R Script | |
setwd("~/Downloads") # NOTE you might want to change this! | |
# NOTE: It is usually best to transform Excel files into .csv files (in Save as > Csv file) | |
# but anyway, I'm using here the readxl package. | |
# Packages | |
library(vegan) # Species diversity |
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
library(ggplot2) | |
# ------------------------------ | |
gen_dat = function(baseline, change, sd) { | |
data.frame( | |
y = c(rnorm(n=320, mean=baseline, sd=sd), | |
rnorm(n=90, mean=baseline+change, sd=sd)), | |
x = c(rep("out", 320), rep("in", 90)) | |
) |
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
# Generated by Sync Settings for Atom | |
<https://github.com/atom-community/sync-settings> |
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
setwd("...") | |
library(stringr) | |
library(RSelenium) | |
library(XML) | |
library(dplyr) | |
library(muniSpain) | |
options(stringsAsFactors = FALSE) | |
# Encoding problems, using Spanish enconding here | |
Sys.setlocale("LC_ALL", "ES_ES.UTF-8") |
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
setwd("...") | |
library(RSelenium) | |
library(netstat) | |
library(rvest) | |
library(purrr) | |
## ------------------------------------------- | |
## URL list |
OlderNewer