Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gimoya
gimoya / spocc-test
Created March 18, 2014 08:30
testing {spocc}
> library(spocc)
> spp <- c("Myricaria germanica")
> dat <- occ(query = spp, from = "gbif", gbifopts = list(georeferenced = TRUE))
> dat
Summary of results - occurrences found for:
gbif : 25 records across 1 species
bison : 0 records across 1 species
inat : 0 records across 1 species
ebird : 0 records across 1 species
ecoengine : 0 records across 1 species
@gimoya
gimoya / jpeg_transparency.R
Created December 12, 2011 10:50
function for adding transparency to a jpeg-image
# file: jpeg_transparency.R
# purpose: add transparency to jpeg
# author: kay cichini
# arguments: path_to_jpeg, path_to_outfile, alpha (transparency 0-1)
# path_to_outfile defaults to default home directory
# alpha defaults to 0.5
# packages used: jpeg, png
# input: a jpeg image
# output: a png image
@gimoya
gimoya / source_tBB.R
Created December 13, 2011 07:57
Function to source theBioBucket-Scripts
source_tBB <- function(file) {
# read theBioBucket-scripts using a security certificate
u <- paste("https://raw.github.com/gimoya/theBioBucket-Archives/master/R/", file, sep = "")
script <- getURL(u, followlocation = TRUE,
cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl"))
# parse lines and evaluate in the global environement
eval(parse(text = script), envir= .GlobalEnv)
}
@gimoya
gimoya / fun_install_github.R
Created January 1, 2012 13:31
Function to source all functions from a R github-repository
fun_install_github <- function (repo = "theBioBucket-Archives",
username = "gimoya",
branch = "master")
{require(RCurl)
message("\nInstalling ", repo, " R-functions from user ", username)
name <- paste(username, "-", repo, sep = "")
url <- paste("https://github.com/", username, "/", repo,
sep = "")
zip_url <- paste("https://nodeload.github.com/", username,
"/", repo, "/zipball/", branch, sep = "")
@gimoya
gimoya / google_ss.R
Created March 13, 2012 13:30
Read spreadsheet data from Google Docs to R workspace
google_ss <- function(gid = NA, key = NA)
{
if (is.na(gid)) {stop("\nWorksheetnumber (gid) is missing\n")}
if (is.na(key)) {stop("\nDocumentkey (key) is missing\n")}
require(RCurl)
url <- getURL(paste("https://docs.google.com/spreadsheet/pub?key=", key,
"&single=true&gid=", gid, "&output=csv", sep = ""),
cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl"))
read.csv(textConnection(url), header = T, sep = ",")
}
@gimoya
gimoya / test.csv
Created March 15, 2012 08:31
CSV-Data for testing read.table() with github:gist data
id age tolerance male exposure time
9 11 2.23 0 1.54 0
9 12 1.79 0 1.54 1
9 13 1.9000000000000001 0 1.54 2
9 14 2.12 0 1.54 3
9 15 2.66 0 1.54 4
45 11 1.12 1 1.16 0
45 12 1.45 1 1.16 1
45 13 1.45 1 1.16 2
45 14 1.45 1 1.16 3
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
; -> Kommentar
; Erläuterung Syntax:
; ::vegl:: vor Abk. -> sobald 'vegl' UND ',' oder '.' oder ' ' getippt wird, wird Wort vervollständigt
; :*:UW:: -> sobald 'UW' oder 'uw' getippt wird, wird 'UNTERWUCHS' oder 'Unterwuchs' vervollständigt
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
::UW::Unterwuchs
::SS::Strauchschicht
@gimoya
gimoya / QGIS with Bergfex Tile Source
Last active December 22, 2015 09:19
This script can be used with the QGIS OpenLayers Plugin to get tiles from Bergfex (= OEK 50, Austrian topographic map). See here: [http://gis.stackexchange.com/questions/70648/using-custom-source-for-qgis-openlayers-plugin] and here: [http://gis.stackexchange.com/questions/69907/easiest-way-to-create-historical-street-maps-using-qgis] for refere…
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>OpenLayers Bergfex Topo Layer</title>
<link rel="stylesheet" href="qgis.css" type="text/css">
<script src="OpenLayers.js"></script>
<script src="OlOverviewMarker.js"></script>
<script type="text/javascript">
var map;
var loadEnd;
var oloMarker; // OpenLayer Overview Marker
@gimoya
gimoya / shBrushR.js
Created February 11, 2012 19:25
SyntaxHighlighter Brush for the R Language
/**
* Author: Yihui Xie
* URL: http://yihui.name/en/2010/09/syntaxhighlighter-brush-for-the-r-language
* License: GPL-2 | GPL-3
*/
SyntaxHighlighter.brushes.R = function()
{
var keywords = 'if else repeat while function for in next break TRUE FALSE NULL Inf NaN NA NA_integer_ NA_real_ NA_complex_ NA_character_';
var constants = 'LETTERS letters month.abb month.name pi';
this.regexList = [