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
<?php | |
include_once('../simple_html_dom.php'); | |
function scraping($url) { | |
// create HTML DOM | |
$html = file_get_html($url); | |
// Find the table that has class="tabelle_spieler" in the source code | |
// There are two of these tables and we want the second one therefor 1 (index start by 0) |
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) | |
library(gtable) | |
library(grid) | |
library(ggthemes) | |
# extract gtable | |
ggplot_second_axis <- function(p1, p2){ | |
p2 <- p2 + theme() %+replace% |
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
diverge0 <- function(p, ramp) { | |
# p: a trellis object resulting from rasterVis::levelplot | |
# ramp: the name of an RColorBrewer palette (as character), a character | |
# vector of colour names to interpolate, or a colorRampPalette. | |
require(RColorBrewer) | |
require(rasterVis) | |
if(length(ramp)==1 && is.character(ramp) && ramp %in% | |
row.names(brewer.pal.info)) { | |
ramp <- suppressWarnings(colorRampPalette(brewer.pal(11, ramp))) | |
} else if(length(ramp) > 1 && is.character(ramp) && all(ramp %in% colors())) { |
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
# Drawing a scatter plot of raster images | |
doInstall <- TRUE # Change to FALSE if you don't want packages installed. | |
toInstall <- c("png", "devtools", "MASS", "RCurl") | |
if(doInstall){install.packages(toInstall, repos = "http://cran.r-project.org")} | |
lapply(toInstall, library, character.only = TRUE) | |
# Some helper functions, lineFinder and makeTable | |
source_gist("818983") | |
source_gist("818986") |
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(rCharts) | |
require(rjson) | |
#get source from original example | |
#this is a JSON, so will need to translate | |
#this is complicated and unnecessary but feel I need to replicate | |
#for completeness | |
#expect most data to come straight from R | |
#in form of source, target, value |
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
face | suit | value | |
---|---|---|---|
king | spades | 13 | |
queen | spades | 12 | |
jack | spades | 11 | |
ten | spades | 10 | |
nine | spades | 9 | |
eight | spades | 8 | |
seven | spades | 7 | |
six | spades | 6 | |
five | spades | 5 |