Skip to content

Instantly share code, notes, and snippets.

View woobe's full-sized avatar
🏡
WFH

Jo-fai Chow woobe

🏡
WFH
View GitHub Profile
@woobe
woobe / README.md
Last active August 29, 2015 13:57
[rblocks]: Experiments
View README.md

The rBlocks Experiement

Having fun with Ramnath Vaidyanathan's new package rblocks!

Iris & AirPassengers

iris

ap

@woobe
woobe / README.md
Last active August 29, 2015 14:00
[Rcpp]: Code Snippets
View README.md

Rcpp Code Snippets

Learning Rcpp to speed things up!

simple_comparison.R

Example: Fibonacci Recursive expr min lq median uq max neval

@woobe
woobe / index.html
Last active August 29, 2015 14:02
[rChartsCalendar]: Points Scored by Paul George
View index.html
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<link rel='stylesheet' href='http://cdn.jsdelivr.net/cal-heatmap/3.3.10/cal-heatmap.css'>
<script src='http://d3js.org/d3.v3.min.js' type='text/javascript'></script>
<script src='http://cdn.jsdelivr.net/cal-heatmap/3.3.10/cal-heatmap.min.js' type='text/javascript'></script>
<style>
@woobe
woobe / code.R
Last active August 29, 2015 14:02
[rCharts]: Parallel Coordinates Plot x Bart Simpson Colour Palette
View code.R
library(rCharts) ## devtools::install_github("ramnathv/rCharts@dev")
library(rPlotter) ## devtools::install_github("woobe/rPlotter")
## Using Theoph as the demo data.
dat <- Theoph
## Initialise rCharts-parcoords
p1 <- rCharts$new()
p1$setLib(system.file('parcoords', package = 'rCharts'))
@woobe
woobe / code.R
Last active August 29, 2015 14:02
[rCrimemap]: All Crimes in January 2014 on Open Street Map
View code.R
## Load Library
library(rCrimemap) # devtools::install_github("woobe/rCrimemap")
## Create Crime Heatmap with Nokia map base
r1 <- rcmap_quick(period = "2014-01",
map_size = c(960, 500),
provider = "OpenStreetMap.BlackAndWhite",
zoom = 6)
## Save the Heatmap as a self-contained HTML
@woobe
woobe / Readme.md
Last active August 29, 2015 14:06 — forked from timelyportfolio/Readme.md
View Readme.md

Introduction

This d3.js parallel coordinates plot is another experiment in how we might use interactive plots in Javascript to represent a partykit / rpart object from R. The example builds on this d3.js collapsible tree plot. Eventually, it would be nice to combine the tree and parallel coordinates into a layout with synced interactivity.


### Almost No [`rCharts`](http://rcharts.io) Also, this is fairly different from most of my interactive plots from R in that it almost completely avoids [`rCharts`](http://rcharts.io) (almost because I did use its `publish` to make this gist). I chose to exclude `rCharts` for two reasons:
  1. demo how we can use htmltools to build html/js in R
  2. help users understand some of the things rCharts does f
@woobe
woobe / code.R
Last active October 30, 2015 14:11
[recharts]: ECharts Style Area Charts
View code.R
## Load package
library(recharts) ## see https://github.com/taiyun/recharts
## Convert UKgas time series into a matrix
mat_UKgas <- matrix(UKgas, ncol = 4, byrow = TRUE)
rownames(mat_UKgas) <- rep(1960:1986, each = 1)
colnames(mat_UKgas) <- c("Q1", "Q2", "Q3", "Q4")
## Create the echarts plot object
e1 <- eArea(mat_UKgas,
@woobe
woobe / link_data.R
Last active January 7, 2016 15:42
[Blog]: Things to try after useR! Part 1: Regularized Deep Learning with H2O
View link_data.R
@woobe
woobe / h2o_save_load_model.R
Last active June 14, 2017 15:39
An example of saving and loading H2O model in R
View h2o_save_load_model.R
# Example: Saving and loading H2O models
# Using Iris for this example
d_train <- iris
# Initialize H2O
library(h2o)
h2o.init(nthreads = -1)
# Train a DRF model
@woobe
woobe / README.md
Last active December 21, 2017 16:41
[rPlotter]: Customised Palette Experiments
View README.md

Introduction

I created a function called "extract_colours()" in my "rPlotter" package. Using this function, any image in PNG, JPG, JPEG or TIFF format can be converted into a simple colour palette.

YET, this is my very first attempt, the colours are only sorted by alphabetical order at the moment. More work is needed to arrange colours based on colour theory and other factors.

Example 1a - R Logo R Logo

Output 1a