Skip to content

Instantly share code, notes, and snippets.

@mhermans
mhermans / Dockerfile
Created November 15, 2015 23:10
Dockerfile for GPX-hiking visualisation blogpost
# R image with dev libs & packages for GIS
# =========================================
FROM rocker/hadleyverse
MAINTAINER "Maarten Hermans" maarten@mhermans.net
# apt-get packages
# ----------------
RUN apt-get update && apt-get install -y --no-install-recommends \
@rasmusab
rasmusab / tensorflow_in_r_using_rpython.R
Last active April 25, 2018 02:35
An example of building a TensorFlow model from R using rPython
### An example of building a TensorFlow model from R using rPython ###
# For this script you need to
# 1. Have python 2.7 installed.
# 2. Install the rPython package in R.
# 3. Install Google's TensorFlow library as per these instructions:
# http://www.tensorflow.org/get_started/os_setup.md#binary_installation
### Here is how to setup and run a trivial TensorFlow model ###
# Load TensorFlow (I couldn't get this to work without setting sys.argv... )
@timelyportfolio
timelyportfolio / Readme.md
Last active September 6, 2015 12:59
use underscore.nest with V8 in R to feed networkD3

underscore.nest | Helpful Tool

A couple years ago, Irene Ros made this handy underscore.nest to create the somewhat tricky nested format to work with many of the the d3.js network layouts. Now, with htmlwidgets, these tricky nested structures are increasingly needed but unfortunately are even more difficult to create in R. V8 from Jeroen Ooms lets us use underscore.nest directly in R.

Example with networkD3 and Titanic

# use https://github.com/iros/underscore.nest in R with V8

library(V8)
# if want hierNetwork use this branch of networkD3 not yet pulled
# devtools::install_github("timelyportfolio/networkD3@feature/d3.chart.layout")
@timelyportfolio
timelyportfolio / code.R
Last active September 6, 2015 12:17
make a pdf in R with hpdf.js - emscripten port of libharu
# run these hpdf.js examples
# http://manuels.github.io/hpdf.js/
# in R with V8
library(V8)
library(pipeR)
library(htmltools)
ct = new_context("window")
ct$source("https://raw.githubusercontent.com/manuels/hpdf.js/master/hpdf.min.js")