Skip to content

Instantly share code, notes, and snippets.


Sebastian Kopf sebkopf

View GitHub Profile

The latest version of the devtools package on CRAN (version 1.12.0) has a bug that causes issues with the installation of package dependencies on Windows, which usually manifest as errors during the installation of GitHub packages stating some dependency (e.g. stringi or dplyr or htmltools, etc. package missing). The issue is described in various bug reports and was fixed in December 2016 (devtools issue #1409). However, as of March 2017, this bug fix has not propagated to the version of devtool on CRAN yet. The easiest solution is to use the fixed devtools from GitHub (this specific commit fixes the problem) for the installation of GitHub packages. Windows may not allow installation of a GitHub version of devtools using devtools (because it cannot overwrite the loaded package), in which case the easiest approach is to use the build_github_devtools function whic

sebkopf / .gitignore
Last active Mar 8, 2016
In situ phototroph enrichment box
sebkopf /
Last active Apr 28, 2020
wolfram alpha from R

Wolfram Alpha API from R

The attached code file provides an easy basic interface to the Wolfram Alpha API. Inspired by the wolframalpha module available for Python.


Initialize client

sebkopf / analysis.Rmd
Last active Mar 30, 2020
R markdown tutorial
View analysis.Rmd
title: "Analysis test"
output: html_document
```{r, echo=FALSE, warning=FALSE}
# This code chunk simply makes sure that all the libraries used here are installed, it will not be shown in the report (notice echo = FALSE).
packages <- c("readxl", "knitr", "tidyr", "dplyr", "ggplot2", "plotly")
if ( length(missing_pkgs <- setdiff(packages, rownames(installed.packages()))) > 0) {
message("Installing missing package(s): ", paste(missing_pkgs, collapse = ", "))
sebkopf /
Last active Jun 16, 2020
Installation information for R with GTK on Windows/Mac OS

Installation information for R with GTK+


Install the newest version of R. Additionally, I highly recommend R-Studio for working with R regularly (but the basic command line will work just fine for most applications). Once R is installed, you can install GTK directly from within R (details below). In short:

  1. From the R command line (e.g. in R-Studio), install the RGtk2 package by running: install.packages("RGtk2", depen=T)
    This might fail with the warning that package ‘RGtk2’ is not available (for R version xxx) if your version of R has been released very recently. If so, just run install.packages("RGtk2", depen=T, type="source") instead to install the RGtk2 package directly from its source code (this might take a few
View nPlot_with_y2Axis.R
library(rjson) # required for overwrite
# load rCharts and extend Nvd3 object to allow y2Axis parameters (not implemented in rCharts yet)
nPlot <- function(x, data, ...){
Nvd3mod <- setRefClass('Nvd3mod', contains = 'Nvd3', methods = list(
initialize = function(){
LIB <<- get_lib('nvd3') # library name and url to parent library
templates$script <<- 'NVD3.html' # chart template to include y2Axis-
params <<- c(params, list(y2Axis = list()))
sebkopf / NVD3.template.html
Last active Dec 25, 2015
NVD3 template that supports y2Axis paramters for making lineWithFocusCharts
View NVD3.template.html
<script type='text/javascript'>
function draw{{chartId}}(){
var opts = {{{ opts }}},
data = {{{ data }}}
var data = d3.nest()
sebkopf / Isotope labeling and growth.ipynb
Last active Dec 25, 2015
Isotope Labeling Computation
View Isotope labeling and growth.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
You can’t perform that action at this time.