Skip to content

Instantly share code, notes, and snippets.

View sebkopf's full-sized avatar

Sebastian Kopf sebkopf

  • University of Colorado Boulder
View GitHub Profile
@sebkopf
sebkopf / Isotope labeling and growth.ipynb
Last active December 25, 2015 07:58
Isotope Labeling Computation
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sebkopf
sebkopf / NVD3.template.html
Last active December 25, 2015 09:39
NVD3 template that supports y2Axis paramters for making lineWithFocusCharts
<script type='text/javascript'>
$(document).ready(function(){
draw{{chartId}}()
});
function draw{{chartId}}(){
var opts = {{{ opts }}},
data = {{{ data }}}
var data = d3.nest()
.key(function(d){
@sebkopf
sebkopf / .gitignore
Last active March 8, 2016 06:31
In situ phototroph enrichment box
originals

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

library(rCharts)
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(){
callSuper();
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
sebkopf / analysis.Rmd
Last active March 30, 2020 03:47
R markdown tutorial
---
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
sebkopf / README.md
Last active April 6, 2023 10:11
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.

source("wa_lib.R")

Initialize client

@sebkopf
sebkopf / gtk_install.md
Last active February 22, 2024 06:10
Installation information for R with GTK on Windows/Mac OS

Installation information for R with GTK+

Windows

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