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(foreign) | |
library(RCurl) | |
addresses <- read.csv("~/links.csv") # Create a .csv file with all of the links you want to crawl | |
for (i in addresses) full.text <- getURL(i) | |
text.sub <- gsub("<.+?>", "", full.text) # Removes HTML tags | |
text <- data.frame(text.sub) |
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
# Create Google Motion Chart from World Bank Finance Data | |
# Inspired by http://lamages.blogspot.com/2011/09/accessing-and-plotting-world-bank-data.html | |
# Written by Christopher Gandrud | |
# 15 October 2011 | |
library(WDI) | |
library(gregmisc) | |
library(googleVis) | |
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
## Download websites | |
addresses <- read.csv("~/links.full.csv") | |
for (i in addresses){ | |
fed.text <- getURL(i) | |
} | |
fed.df <- as.data.frame(fed.text) |
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
## Download websites | |
addresses <- read.csv("~/links.full.csv") | |
for (i in addresses){ | |
fed.text <- getURL(i) | |
} | |
fed.df <- as.data.frame(fed.text) |
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
# Scraping and plotting InTrade data | |
doInstall <- TRUE # Change to FALSE if you don't want packages installed. | |
toInstall <- c("ggplot2", "lubridate") | |
if(doInstall){install.packages(toInstall, repos = "http://cran.r-project.org")} | |
lapply(toInstall, library, character.only = TRUE) | |
# Fin the "contractId" of the contract in which you're interested | |
# Let's try Barack Obama to win the third Presidential debate: | |
# http://www.intrade.com/v4/markets/contract/?contractId=766623 | |
contractID <- 766623 # second debate is 766621 |
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
# Better alternatives to 3-D | |
# Here are some examples of what we don't want to do: | |
# http://stackoverflow.com/questions/12765497/create-a-ribbon-plot | |
doInstall <- TRUE # Change to FALSE if you don't want packages installed. | |
toInstall <- c("ggplot2") | |
if(doInstall){install.packages(toInstall, repos = "http://cran.r-project.org")} | |
lapply(toInstall, library, character.only = TRUE) | |
# Air passenger data. ts converted to long matrix: |
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
doInstall <- TRUE | |
toInstall <- c("twitteR", "lubridate") | |
if(doInstall){install.packages(toInstall, repos = "http://cran.us.r-project.org")} | |
lapply(toInstall, library, character.only = TRUE) | |
searchTerms <- c("New York", "Los Angeles", "Chicago", "Houston", "Philadelphia", | |
"Phoenix", "San Antonio", "San Diego", "Dallas", "San Jose", | |
"Jacksonville", "Indianapolis", "Austin", "San Francisco", | |
"Columbus", "Fort Worth", "Charlotte", "Detroit", "El Paso", | |
"Memphis") |
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
<!doctype HTML> | |
<meta charset = 'utf-8'> | |
<html> | |
<head> | |
<script src='http://polychart.com/s/third_party/polychart2.standalone.js' type='text/javascript'></script> | |
<style> | |
.rChart { | |
display: block; |
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
<!doctype HTML> | |
<meta charset = 'utf-8'> | |
<html> | |
<head> | |
<link rel='stylesheet' href='http://nvd3.org/src/nv.d3.css'> | |
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js' type='text/javascript'></script> | |
<script src='http://d3js.org/d3.v2.min.js' type='text/javascript'></script> | |
<script src='http://nvd3.org/nv.d3.js' type='text/javascript'></script> | |
<script src='http://nvd3.org/lib/fisheye.js' type='text/javascript'></script> |
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
<!doctype HTML> | |
<meta charset = 'utf-8'> | |
<html> | |
<head> | |
<link rel='stylesheet' href='http://cdn.leafletjs.com/leaflet-0.5.1/leaflet.css'> | |
<script src='http://cdn.leafletjs.com/leaflet-0.5.1/leaflet.js' type='text/javascript'></script> | |
<script src='https://rawgithub.com/leaflet-extras/leaflet-providers/gh-pages/leaflet-providers.js' type='text/javascript'></script> | |
<style> |
OlderNewer