Skip to content

Instantly share code, notes, and snippets.

@muschellij2
Last active December 15, 2015 19:19
Show Gist options
  • Save muschellij2/5310615 to your computer and use it in GitHub Desktop.
Save muschellij2/5310615 to your computer and use it in GitHub Desktop.
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")
js <- toJSON(ll, pretty=TRUE)
# f <- file("Overlap_Statistics.json")
# cat(js, file=f)
# close(f)
if (length(dropouts) == 1) dropouts <- list(dropouts)
# Parameters to pass to javascript
d3Params <- list(json=js,
dropouts=dropouts,
n = n,
...)
# Form input types and ranges/options
varType <- c("factor")
varList <- list("variable" = dropouts)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment