Skip to content

Instantly share code, notes, and snippets.

View muschellij2's full-sized avatar

John Muschelli muschellij2

View GitHub Profile
@muschellij2
muschellij2 / gist:4606458
Created January 23, 2013 14:31
Modifications to forestplot2 from package rmeta in R (CRAN)
forestplot2 <- function (labeltext, mean, lower, upper, align = NULL, is.summary = FALSE,
clip = c(-Inf, Inf), xlab = "", zero = 0, graphwidth = unit(2,
"inches"), col = meta.colors(), xlog = FALSE, xticks = NULL,
boxsize = NULL, fontsize=5, xrange=NULL, add=FALSE, cgap = unit(8, "mm"), type="rect", ...)
{
require("grid") || stop("`grid' package not found")
require("rmeta") || stop("`rmeta' package not found")
drawNormalCI <- function(LL, OR, UL, size, boxcol, linecol, itype) {
circle <- ifelse(itype == "circle", TRUE, FALSE)
size = 0.75 * size
@muschellij2
muschellij2 / gist:4773311
Created February 12, 2013 20:55
How to read data into a data.frame for Baltimore City 311 system.
rm(list=ls())
library(XML)
library(RJSONIO)
library(stringr)
ff <- url("http://311.baltimorecity.gov/open311/v2/requests.json?api&jurisdiction_id=baltimorecity.gov")
x <- readLines(ff)
close(ff)
J <- fromJSON(x, asText=TRUE )
@muschellij2
muschellij2 / rgl_vtk_example
Created March 10, 2013 00:44
Minimal working example for vtk export that got "cut off"
rm(list=ls())
require(misc3d)
f <- function(x, y, z) x^2+y^2+z^2
x <- seq(-2,2,len=20)
ball <- contour3d(f,4,x,x,x, draw=FALSE)
drawScene.rgl(ball)
### get the triangles
allids <- rgl.ids()
id <- allids$id[allids$type == "triangles"]
@muschellij2
muschellij2 / Read_Data
Created March 22, 2013 15:33
Reading in Neuroimaging Data R
library(oro.nifti)
img <- readNIfTI("MNI152_T1_2mm_brain.nii.gz")
image(x, z=40, plot.type="single")
arr <- x@.Data
@muschellij2
muschellij2 / matplotVis-excerpt.R
Last active December 15, 2015 19:19
Example code from matplotVis() for healthvis package in R
require(RJSONIO)
classes <-sapply(data, class)
nr <- nrow(data)
cn <- colnames(data)
ll <- vector("list", length=nr)
for (irow in 1:nr) ll[[irow]] <- data[irow,]
dropouts <- cn[classes != "numeric"]
n <- sum(classes=="numeric")
@muschellij2
muschellij2 / index.html
Last active August 29, 2015 13:56
Scatterplot
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<script src='http://ramnathv.github.io/rCharts/libraries/widgets/polycharts/js/polychart2.standalone.js' type='text/javascript'></script>
<style>
.rChart {
display: block;
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<link rel='stylesheet' href='http://nvd3.org/src/nv.d3.css'>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js' type='text/javascript'></script>
<script src='http://d3js.org/d3.v3.min.js' type='text/javascript'></script>
<script src='http://timelyportfolio.github.io/rCharts_nvd3_tests/libraries/widgets/nvd3/js/nv.d3.min-new.js' type='text/javascript'></script>
<script src='http://nvd3.org/lib/fisheye.js' type='text/javascript'></script>
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<link rel='stylesheet' href='http://nvd3.org/src/nv.d3.css'>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js' type='text/javascript'></script>
<script src='http://d3js.org/d3.v3.min.js' type='text/javascript'></script>
<script src='http://timelyportfolio.github.io/rCharts_nvd3_tests/libraries/widgets/nvd3/js/nv.d3.min-new.js' type='text/javascript'></script>
<script src='http://nvd3.org/lib/fisheye.js' type='text/javascript'></script>
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<link rel='stylesheet' href='http://nvd3.org/src/nv.d3.css'>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js' type='text/javascript'></script>
<script src='http://d3js.org/d3.v3.min.js' type='text/javascript'></script>
<script src='http://timelyportfolio.github.io/rCharts_nvd3_tests/libraries/widgets/nvd3/js/nv.d3.min-new.js' type='text/javascript'></script>
<script src='http://nvd3.org/lib/fisheye.js' type='text/javascript'></script>
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<link rel='stylesheet' href='http://nvd3.org/src/nv.d3.css'>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js' type='text/javascript'></script>
<script src='http://d3js.org/d3.v3.min.js' type='text/javascript'></script>
<script src='http://timelyportfolio.github.io/rCharts_nvd3_tests/libraries/widgets/nvd3/js/nv.d3.min-new.js' type='text/javascript'></script>
<script src='http://nvd3.org/lib/fisheye.js' type='text/javascript'></script>