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
require(rjson) | |
library(httr) | |
require(gtools) | |
dataframeFromJSON <- function(l) { | |
l1 <- lapply(l, function(x) { | |
x[sapply(x, is.null)] <- NA | |
unlist(x) | |
}) |
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(RCurl) | |
didYouMean=function(input){ | |
input=gsub(" ", "+", input) | |
doc=getURL(paste("http://www.google.com/search?q=",input,"/", sep="")) | |
dym=gregexpr(pattern ='Did you mean',doc) | |
srf=gregexpr(pattern ='Showing results for',doc) | |
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
require(jsonlite) | |
require(V8) | |
#Task: get the Data from the last table: http://www.thebrandticker.com/en/ | |
## public XHR needs a JS time-stamp. | |
#http://www.thebrandticker.com/ticker.json?1436337115096 | |
#http://www.thebrandticker.com/brands.json?1436337115102 |
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
## daily stock market data from Yahoo | |
getStockMarketData <- function(symbol = "VOW4.DE"){ | |
require(stringr) | |
if(str_detect(symbol, ":")){ | |
symbol <- paste(str_split_fixed(symbol, ":", 2)[,2], str_split_fixed(symbol, ":", 2)[,1], sep=".") | |
} | |
URL <- paste("http://ichart.finance.yahoo.com/table.csv?ignore=.csv&s=",symbol) |
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
require(rvest) | |
require(stringr) | |
url <- "http://www.wettfreunde.net/bundesliga-absteiger-wetten/" | |
# Darmstadt | |
1/2.25 | |
1/2.3 | |
mv <- html(url) |
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
#devtools::install_github("chgrl/diezeit") | |
library(diezeit) | |
require(ggplot2) | |
library(plyr) | |
require(stringr) | |
require(ggthemes) | |
options(stringsAsFactors = FALSE) |
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
# a simple script to illustrate the relationship between panel-based measurement error and panel sizes | |
# simple case of party estimate! | |
require(plyr) | |
require(ggplot2) | |
require(ggthemes) | |
n=1000 | |
p=5 |
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
options(stringsAsFactors = FALSE) | |
require(rvest) | |
scrapeJSSite <- function(dfrom, dto, date="2016-03-27"){ | |
## change Phantom.js scrape file | |
url <- paste0("https://www.busliniensuche.de/suche/?From=",dfrom,"&To=",dto,"&When=",date,"&ShowRidesharing=false&Company=Alle+Busunternehmen&Passengers=1&SearchMode=0&Radius=15000") | |
lines <- readLines("scrape_final.js") | |
lines[1] <- paste0("var url ='", url ,"';") |
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
## please see flovv.github.com for a short blog post on running the code. | |
#devtools::install_github("MarkEdmondson1234/googleAuthR") | |
require(googleAuthR) | |
require(RCurl) | |
### plug in your credentials | |
## create project- enable billing- -- enable APIs Vision APi -- go to credentials create OAuth 2.0 client ID: copy client_id and client_secret from JSON file. |
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
## gather data: | |
require(Roxford) | |
images <- list.files("sample bilder/") | |
facekey = "API KEY" | |
for(i in images[1:200]){ | |
dff <- getFaceResponse(paste0("sample bilder/",i), facekey) |
OlderNewer