Code Monkey home page Code Monkey logo

clickme's Introduction

deprecated and archived - see htmlwidgets

clickme

clickme is an R package that makes JavaScript visualizations using R data objects as input. Its goal is to make interactive visualizations as easy to use as the base plot function.

Instead of static JS files, clickme works with ractives (short for interactivesโ€”a hat tip to Neal Stephenson), which are simple folder structures that contain a template file used to populate the JS code with R input data. This model makes visualizations easy to access and reuse within R.

Want to learn more? See the wiki.

Quick Usage

Run this in your R session to install or update to the latest version of clickme:

install.packages("devtools")
install.packages("knitr", repos = "http://www.rforge.net/", type = "source")

library(devtools)
install_github("clickme", "nachocab")

Now you can try the examples:

library(clickme)

# visualize the same dataset in different ways using Vega
data <- data.frame(x = 1:20, y = c(28,55,43,91,81,53,19,87,52,48,24,49,87,66,17,27,68,16,49,15))
clickme_vega(data, "area")
clickme_vega(data, "bar")
clickme_vega(data, "scatter")

# visualize a (funky) zoomable phylogenetic tree (www.onezoom.org)
mammals_path <- system.file(file.path("examples", "one_zoom", "data", "mammals.tree"), package="clickme")
clickme(mammals_path, "one_zoom")

# visualize a force-directed interactive graph
items <- paste0("GENE_", 1:40)
n <- 30
df1 <- data.frame(a = sample(items, n, replace = TRUE), b = sample(items, n, replace = TRUE), type = sample(letters[1:3], n, replace=TRUE))
clickme(df1, "force_directed")

# visualize a line plot that allows zooming along the x-axis
n <- 30
cities <- c("Boston", "NYC", "Philadelphia")
df2 <- data.frame(name = rep(cities, each = n), x = rep(1:n, length(cities)), y = c(sort(rnorm(n)), -sort(rnorm(n)),sort(rnorm(n))))
clickme(df2, "line_with_focus")

# visualize an interactive heatmap next to a parallel coordinates plot
df3 <- matrix(rnorm(200), ncol = 8,nrow = 25)
rownames(df3) <- paste0("GENE_", 1:25)
colnames(df3) <- paste0("sample_", 1:8)
clickme(df3, "longitudinal_heatmap") # you will need to have a local server for this one. Try running python -m SimpleHTTPServer

Your browser will open a new tab for each example. They should look something like this.

Acknowledgements

Thank you Mike Bostock for creating the D3.js library. Being able to use it more effectively is the main reason why I developed clickme.

Thank you Yihui Xie for building the knitr R package. Even though clickme only uses knitr as a templating engine, it is the most important part of my daily workflow.

Contributing

If you can see the potential of clickme as a bridge between the R and JS worlds, please contribute by building a ractive, reporting an issue, or improving the source code.

clickme's People

Contributors

nachocab avatar timelyportfolio avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.