Skip to content

Instantly share code, notes, and snippets.

View OrenBochman's full-sized avatar
🏠
Working from home

Oren Bochman OrenBochman

🏠
Working from home
  • WMF
  • 18:50 (UTC +02:00)
View GitHub Profile
My first examples with [***knitr***](http://yihui.name/knitr/)
-----------------------------------------
Let's include some simple R code:
```{r}
1+2
```
That worked.
Let's include a plot:
```{r fig.width=4, fig.height=4}
dat <- data.frame(party=c("CDU", "FDP", "CSU", "SPD",
"The Left", "The Greens"),
members.of.parliament=c(193, 93, 44,
146, 76, 68))
library(googleVis)
## Doughnut chart - a pie with a hole
doughnut <- gvisPieChart(dat,
options=list(
width=500,
height=500,
dat <- data.frame(Product=c("Milk", "Butter", "Yoghurt", "<b>Sum</b>"),
Revenue=c(2230, 43908, 231, 46369))
dat <- within(dat, {'% of Revenue' <- c(Revenue / Revenue[4])})
library(googleVis)
tbl <- gvisTable(dat, options=list(width=300, height=150),
formats=list(Revenue="#,###", '% of Revenue'='#.#%'),
chartid="formattedtable")
plot(tbl)
set.seed(1234)
dat <- data.frame(x=LETTERS[1:10], y_1=sample(15,10), y_2=sample(150,10))
area2 <- gvisAreaChart(xvar="x", yvar=c("y_1", "y_2"), data=dat,
options=list(
series="[{targetAxisIndex:0},
{targetAxisIndex:1}]",
vAxes="[{viewWindowMode:'explicit',
viewWindow:{min:0, max:10}},
{viewWindowMode:'explicit',
viewWindow:{min:0, max:100}}]",
@OrenBochman
OrenBochman / README.md
Created September 22, 2013 23:39 — forked from mbostock/.block

From Wikipedia:

Epicyclic gearing or planetary gearing is a gear system consisting of one or more outer gears, or planet gears, revolving about a central, or sun gear. … Epicyclic gearing systems also incorporate the use of an outer ring gear or annulus, which meshes with the planet gears.

Use the menu in the top-left to change the frame of reference, fixing the specified gear in-place.

@OrenBochman
OrenBochman / index.Rmd
Last active August 29, 2015 14:11 — forked from ramnathv/index.Rmd
two colum markdown format for use exclusively with revealjs
---
title : RevealJS with Bootstrap
framework : revealjs
widgets : [bootstrap] # {mathjax, quiz, bootstrap}
---
## Read-And-Delete
1. Edit YAML front matter
2. Write using R Markdown
@OrenBochman
OrenBochman / tomer.py
Last active August 29, 2015 14:12 — forked from daonb/tomer.py
'''
to make this work you need to have Open-Knesset source and latest db file
from the shell type::
$ python manage.py shell_plus
In [1]: ed tomer.py
'''
import json, urllib2
votes=[6904,7454,6786]
@OrenBochman
OrenBochman / magic_script_modified.js
Created February 14, 2016 15:22 — forked from IronistM/magic_script_modified.js
A mash-up of the Magic Script with Measument protocol hits to track usage of the Spreadsheet and log events. #analytics #drive
/**
* A script to automate requesting data from Google Analytics.
*
* @author [email protected] (Nick Mihailovski)
*/
/**
* The name of the configration sheet.
* And various parameters.
#
# PREDICTING LONG TERM CUSTOMER VALUE WITH BTYD PACKAGE
# Pareto/NBD (negative binomial distribution) modeling of
# repeat-buying behavior in a noncontractual setting
#
# Matthew Baggott, [email protected]
#
# Accompanying slides at:
# http://www.slideshare.net/mattbagg/baggott-predict-customerinrpart1#
#
@OrenBochman
OrenBochman / predicting_customer_behav_1.R
Created February 14, 2016 15:55 — forked from mattbaggott/predicting_customer_behav_1.R
Uses the BTYD package and Pareto/NBD model to predict customer behavior in R Slides are at: http://www.slideshare.net/mattbagg/baggott-predict-customerinrpart1#
#
# PREDICTING LONG TERM CUSTOMER VALUE WITH BTYD PACKAGE
# Pareto/NBD (negative binomial distribution) modeling of
# repeat-buying behavior in a noncontractual setting
#
# Matthew Baggott, [email protected]
#
# Accompanying slides at:
# http://www.slideshare.net/mattbagg/baggott-predict-customerinrpart1#
#