Using the Google Elevation API at the following link https://developers.google.com/maps/documentation/elevation/
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
#' Jitter-dodge points to align them with a boxplot including fill aesthetic | |
#' | |
#' @family position adjustments | |
#' @param width degree of jitter in x direction. Defaults to 40\% of the | |
#' resolution of the data. | |
#' @param height degree of jitter in y direction. Defaults to 40\% of the | |
#' resolution of the data | |
#' @export | |
#' @examples | |
#' dsub <- diamonds[ sample(1:nrow(diamonds), 1000), ] |
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
`:` = function (a, b) { | |
if (inherits(a, 'xrange')) | |
do.call(seq, as.list(c(range(a), by = b))) | |
else if (inherits(a, 'factor')) | |
interaction(a, b, sep = ':') | |
else | |
structure(seq(a, b), class = 'xrange') | |
} | |
print.xrange = function (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
## Correlation matrix with p-values. See http://goo.gl/nahmV for documentation of this function | |
cor.prob <- function (X, dfr = nrow(X) - 2) { | |
R <- cor(X, use="pairwise.complete.obs") | |
above <- row(R) < col(R) | |
r2 <- R[above]^2 | |
Fstat <- r2 * dfr/(1 - r2) | |
R[above] <- 1 - pf(Fstat, 1, dfr) | |
R[row(R) == col(R)] <- NA | |
R | |
} |
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
# By Ben Marwick, from: https://gist.github.com/benmarwick/11204658 with modifications by S. Graham | |
Short instructions to setup a Lubuntu Virtual Machine with | |
R & RStudio: | |
1. Download these: | |
http://lubuntu.net/ (Intel x86 desktop cd) | |
https://www.virtualbox.org/wiki/Downloads (Oracle VM VirtualBox) | |
2. Install Oracle VM VirtualBox, open it (if using windows, |
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
# install.packages("plotGoogleMaps") | |
# install.packages("jsonlite") | |
# install.packages("rgdal") | |
library(jsonlite) | |
library(rgdal) | |
library(plotGoogleMaps) | |
readOGR(dsn = "http://146.148.79.138/sets/Cyprus.json?q=african&response=geo-record&rows=10000", layer = "OGRGeoJSON") -> oa.json | |
m1<-plotGoogleMaps(oa.json,zcol = "early.bce.ce", filename="oa.html") |
https://twitter.com/fgilardi/status/573873339682418689/photo/1
to_char_bars <- function(input){
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
# Load Data | |
grainData <- read.csv('grainSize.csv', check.names=F, na.strings='--' ) | |
# Calculate Derived Sample Values | |
grainData[['Phi Diameter']] <- -log2( grainData[['Grain Diameter']] ) | |
totalWeight <- sum( grainData[['Sample Weight']] ) | |
grainData[["Percent Retained"]] <- grainData[['Sample Weight']] / totalWeight | |
grainData[["Cumulative Percent"]] <- cumsum( grainData[["Percent Retained"]] ) | |
grainData[['Percent Finer']] <- 1 - grainData[['Cumulative Percent']] |
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
# Load Data | |
grainData <- read.csv('grainSize.csv', check.names=F, na.strings='--' ) | |
# Calculate Derived Sample Values | |
grainData[['Phi Diameter']] <- -log2( grainData[['Grain Diameter']] ) | |
totalWeight <- sum( grainData[['Sample Weight']] ) | |
grainData[["Percent Retained"]] <- grainData[['Sample Weight']] / totalWeight | |
grainData[["Cumulative Percent"]] <- cumsum( grainData[["Percent Retained"]] ) | |
grainData[['Percent Finer']] <- 1 - grainData[['Cumulative Percent']] |
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
pasteLabel <- function(preText, inObj, objName, insLink=TRUE){ | |
objNum <- inObj[objName] | |
useText <- paste(preText, objNum, sep=" ") | |
if (insLink){ | |
useText <- paste("[", useText, "](#", objName, ")", sep="") | |
} | |
useText | |
} |
OlderNewer