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
# | |
## 12/21/12 - Ths is my fork of DSparks Denver debate analysis script | |
# | |
########### | |
# Requirement - run this command to create the "denver.txt" file | |
# curl https://raw.github.com/dsparks/Test_image/master/Denver_Debate_Transcript.txt > denver.txt | |
# From: http://www.cnn.com/2012/10/03/politics/debate-transcript/index.html | |
rm(list = ls()) | |
doInstall <- TRUE # Change to FALSE if you don't want packages installed. |
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
# | |
## 12/20/12 - Ths is my fork of DSparks Denver debate analysis script | |
# | |
########### | |
# Requirement - run this command to create the "denver.txt" file | |
# curl https://raw.github.com/dsparks/Test_image/master/Denver_Debate_Transcript.txt > denver.txt | |
# From: http://www.cnn.com/2012/10/03/politics/debate-transcript/index.html | |
# Note - none of these efforts work on Linux or OSX due to SSL / HTTPS limitations | |
############################### |
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
doInstall <- TRUE | |
toInstall <- c("XML", "maps", "ggplot2", "sp") | |
if(doInstall){install.packages(toInstall, repos = "http://cran.us.r-project.org")} | |
lapply(toInstall, library, character.only = TRUE) | |
myURL <- "http://en.wikipedia.org/wiki/United_States_presidential_election,_2012" | |
allTables <- readHTMLTable(myURL) | |
str(allTables) # Look at the allTables object to find the specific table we want | |
stateTable <- allTables[[15]] # We want the 15th table in the list (updated 12-19-2012) |