Skip to content

Instantly share code, notes, and snippets.

View reisner's full-sized avatar

Roman Eisner reisner

View GitHub Profile
@reisner
reisner / Dockerfile
Last active June 26, 2020 16:25
Installing Oracle libraries on Ubuntu, and ROracle in R
FROM rocker/r-ver:4.0.0-ubuntu18.04
# Basic system Libraries
RUN export DEBIAN_FRONTEND=noninteractive; apt-get -y update \
&& apt-get install -y \
file \
gdal-bin \
libgdal-dev \
libproj-dev \
pandoc \
# Comparing different ways of processing a data frame row-by-row:
library(data.table)
df = data.frame(a = runif(10000), b = runif(10000))
system.time(rbindlist(purrrlyr::by_row(df, function(row) { data.frame(a = row$a) }, .labels = FALSE)$.out))
# user system elapsed
# 4.479 0.008 4.494
# This is fast, but note that 'apply' doesnt preserve types. e.g. character columns will get converted to numeric.
@reisner
reisner / server.R
Created March 22, 2018 21:43
Scatter D3 Javascript Error Demo
server <- function(input, output) {
output$force <- networkD3::renderForceNetwork({
networkD3::forceNetwork(Links = networkD3::MisLinks, Nodes = networkD3::MisNodes,
Source = "source", Target = "target", Value = "value",
NodeID = "name", Group = "group")
})
output$scatterPlot <- scatterD3::renderScatterD3({
scatterD3::scatterD3(x = c(1,2,3,4),
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->