nachocab / clickme Goto Github PK
View Code? Open in Web Editor NEWAn R package to create interactive plots
An R package to create interactive plots
Couldn't you just write the data into the javascript file?
This way, the browser doesn't need to access local files other than the html and js (which I think can do without running a server).
hi nacho,
There's a patch here that helps the rd format properly.
Take what you like and leave the rest :-)
https://github.com/tbates/clickme/commit/514c0bc900d78430e8895ce86abdab79cf754002
Adding new ractives to inst/examples is not sustainable. Perhaps we need a separate repository ("clickme_ractives") to upload them.
We would also need a way to list, sort, rank, and describe them (wiki page?)
I'm open for suggestions
After a new installation of clickme, I can't run either example listed on the readme. Do you have any suggestions on how I should proceed?
First example
clickme(points, rnorm(100))
Error: x has 1 elements, but y has 100
Second example
data(microarray)
clickme(points, x = microarray$significance, y = microarray$logFC,
color_groups = ifelse(microarray$adj.P.Val < 1e-4, "Significant", "Noise"),
names = microarray$gene_name,
x_title = "Significance (-log10)", y_title = "Fold-change (log2)",
extra = list(Probe = microarray$probe_name))
Error in file(con, "w") : cannot open the connection
In addition: Warning messages:
1: In `$.data.frame`(names_groups, group) :
Name partially matched in data frame
2: In `$.data.frame`(names_groups, group) :
Name partially matched in data frame
3: In file(con, "w") :
cannot open file '/usr/local/lib/R/site-library/clickme/output/temp-Points.html': Permission denied
This might not be an issue, so much as a query. I'm new to github, so if that violates any rules please let me know.
With the new points template, I'm trying to make it so that instead of a category being de-selected, the opposite happens. That is the rest of them disappear.
This works fine if I change the line in toggle function to return d.color_group != category
However, when I select two categories, it reverts to old behaviour. Then with 3 it works fine qtqin. I think there is something obvious I'm missing. I'd rather take the time to figure it out, but I'm in deadline and I'd appreciate any help.
Great work on Clickme though.
I like the ractive
idea for quickly generating interactive graphs.
But once you have a graph you like its nice to be able to save for later use as a static html file. For example if I am working on a project in a directory called Project
it would be great if there was a function, saveRactive
that would allow me to save the final html file ( or htmlfile plus supporting files). I am thinking something like:
##generate ractive
x <- clickme(cars, "par_coords")
##save ractive
saveRactive(x, name = "coolgraph", directory="Project" )
I could then send the coolgraph
HTML file to a collaborator or embed it in a slideshow. This would require a function that would keep track of all of the path directories and save all of the supporting documents to the target directory. Although I don't think it would work well here, I have used Frozen-Flask for this purpose previous python applications.
talk about show_info("ractive")
describe the fields of opts
hi, im interested in creating templates for gis/geo projects. i saw that you commented recently about completely refactoring the package, and that now the templates have been updated significantly. do you expect to make major changes over the next few days? weeks?
I would like to use clickme within another package, but it seems like it needs to be attached to work. For example, if I run:
clickme::clickme('points', to_plot[, 1], to_plot[, 2],
color_groups = factor(to_plot$point_colors),
names = to_plot$point_names)
I get:
Error in callSuper() : could not find function "%or%"
First of all, congratulations and thank you for this great tool!
The issue:
df2 is OK but when I run clickme this is the result:
clickme(df2, "line_with_focus")
Renaming: name => line
Renaming: y => TRUE
Error in[.data.frame
(data, data$line == line, c("x", "y")) :
undefined columns selected
I am running R under Ubuntu 12.10
probably good to explain what running a local server means...
Make sure you have a server running at: /Users/tim/Library/R/2.15/library/clickme/examples
data can be a list that contains n dataframes - check if any of the elements is a dataframe or a matrix (this distinguishes it from a regular list)
When a new ractive is about to be used, show something like:
The xxx ractive requires the following packages:
- rjson
- df2json
Type "c" If you want to manually install them,
otherwise press "enter" and clickme will install them for you.
Ractives coming down the pipeline
Hi,
What is the best way to embed the chart/plot into an rNotebook/knitr rather than open as a new tab?
library(clickme)
c1<-clickme(points, 1:10)
Is there something like
print(c1)
or
c1$print("chart")
Thanks,
Roy
Add an excel-like view to the par_coords ractive
Enable clicking on scatterplot/zoomable_scatterplot so names can be copy/pasted
Hello
This is a great package however I'm trying to run your asteroids example that you posted with RShiny and I got this error ‘html’ is not a valid field or method name for reference class “Points”. I'm running chrome.. When I run the clickme function from command line it works fine...
thanks
steve
Here's my session info:
Platform: x86_64-apple-darwin10.8.0 (64-bit)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] data.table_1.9.2 rjson_0.2.13 stringr_0.6.2 knitr_1.6 yaml_2.1.11 clickme_0.4.0 ggplot2_0.9.3.1
[8] rrdf_2.0.2 rrdflibs_1.3.0 rJava_0.9-6 shiny_0.10.0 rCharts_0.4.5
opts$get_param("padding")
, this can be overloaded in the translator
opts$get_data_as_json()
In running the example, I got
Error in FUN("df2json"[[1L]], ...) :
Package df2json is not installed, try install.packages("df2json")
df2json
should be added to Imports:
in the DESCRIPTION
file.
Mention you have to use new syntax
valid_names: => data_names: required: or optional:
default_parameters: => params:
give warning if param is provided by user that is not used in any template.Rmd placeholder
The server function has some problems:
server()
sh: pushd: not found
/usr/bin/python: No module named SimpleHTTPServer8888
sh: popd: not found
the pushd/popd errors come because the shell is sh and not bash. In fact there's no need to pushd/popd since you can just 'cd' to the directory in the system command:
system("cd /foo/bar/baz ; python -m SimpleHTTPServer 8888")
won't change the R setwd() result because system() runs in a subshell.
The other error is because currently your server() function doesn't put a space between the host and the port.
You could implement this in R using R's built in web server, thus removing the python dependency.
But hey, this is well cool 👍
I just installed clickme today and R says that there is no clickme_vega function. The preinstalled ractive demos work (force_directed, heatmap, lines, par_coords, points). I grabbed the line_with_focus ractive and it works fine. But, when I grabbed the vega ractive or tried to just use clickme_vega in R, I got the error.
Error in eval(expr, envir, enclos) :
could not find function "clickme_vega"
R version 3.0.1 (2013-05-16) -- "Good Sport"
I see there's a clickme_vega.R file in the clickme_reactives-master folder (I grabbed from https://github.com/nachocab/clickme_ractives). Maybe that needs to go somewhere?
Hi Nachocab,
I just stumbled across your awesome clickme
package - its great and unusually well-documented. I have a question about the par_coord clickme. Is there a way to get categorical columns to display? For example in the cars example - I would like to get the leftmost column to be the names of the cars, something like:
clickme(cars, "par_coords", params=list(color_by="name"))
is there a way to do this?
You might have to explicitly source it, or do clickme::get_padding_params, I'm not sure
I'm brainstorming
I just installed clickme today and R says that there is no clickme_vega function. The preinstalled ractive demos work (force_directed, heatmap, lines, par_coords, points). I grabbed the line_with_focus ractive and it works fine. But, when I grabbed the vega ractive or tried to just use clickme_vega in R, I got the error.
Error in eval(expr, envir, enclos) :
could not find function "clickme_vega"
R version 3.0.1 (2013-05-16) -- "Good Sport"
I see there's a clickme_vega.R file in the clickme_reactives-master folder (I grabbed from https://github.com/nachocab/clickme_ractives). Maybe that needs to go somewhere?
If you have groups of data that you want to color by group in the line_with_focus ractive, well, you might want to look at the line_with_focus2 I have here https://github.com/lcolladotor/ballgownR-devel/tree/master/clickme-test
Basically, I changed things a tiny bit to add a color parameter that specifies an array that is then used by nv.utils.defaultColor from the utils.js file
It was my first attempt at building upon a ractive and seeing if I could customize something to my liking. Thanks for the wiki info!
By the way, that was my first time looking at javascript code and D3. It was more intuitive than what I expected, but it still took me some time to do this small hack.
Maybe you could add these changes to your own line_with_focus and make the color call more robust. I would probably do that inside the translate() function in the translator.R file.
Stuff changed: utils.js line 56, template_config.yml line 28, template.Rmd line 13
hi nacho,
example 3 in the readme attempts to modify df3, but this data.frame has not yet been created...
# visualize an interactive heatmap alongside a parallel coordinates plot
rownames(df3) <- paste0("GENE_", 1:25)
colnames(df3) <- paste0("sample_", 1:8)
clickme(df3, "longitudinal_heatmap") # you will need to have a local server running for this example to work
Hi there! Really impressed with clickme and having fun trying it out. Is there a way to format axis tick labels (similar to format parameter for tooltips) or any plans to add this functionality? For example, removing comma separator for years or thousands?
tentative. I'm still not sure how ractives should be organized.
Hi Nacho:
Newbie here, testing clickme for the first time. I wa looking for the simplest ever hello world tutorial to use your clickme package, and I can't make it work
I installed the package with no issues, set root path to some temporal dummy folder in my home directory (linux user here), and run clickme(points, 1:10), which produced this error message:
clickme(points, 1:10)
Error in get_opts(ractive, ...) :
No ractive named 12345678910 found at:/home/xavi/tmp/ In addition: Warning message:
In if (!file.exists(opts$path$ractive)) stop("No ractive named ", :the condition has length > 1 and only the first element will be used
What am I doing wrong?
Thanks for your help and for developing such intersting clickme package (& open sourced)!
I think it is confusing for new users to know how to run the installed vega examples. Would it be best to go in the wiki or somehow in the documentation? For instance on the lifelines example, the process would go something like:
#if not already installed, uncomment the two lines below
#library(devtools)
#install_github("clickme", "nachocab")
require(clickme)
#set location where you put your multiline ractive
ractivepath = get_root_path()
#if we want to change then comment line above and uncomment next two
#ractivepath = "path to your ractive/"
#set_root_path(ractivepath)
#load the csv data from the example
data = read.csv(paste0(ractivepath,"/vega/data/lifelines_people.csv"),stringsAsFactors=FALSE)
eventdata = read.csv(paste0(ractivepath,"/vega/data/lifelines_events.csv"),stringsAsFactors=FALSE)
#run clickme to create
clickme_vega(spec="lifelines", data=data, params=list(width=400,height=100,event_data=eventdata))
I'm uing RStudio on Windows.
See logs below:
library(devtools)
install_github("clickme", "nachocab")
Installing github repo clickme/master from nachocab
Downloading clickme.zip from https://github.com/nachocab/clickme/archive/master.zip
Installing package from C:\Users\axcv\AppData\Local\Temp\RtmpS6qBes/clickme.zip
Installing clickme
"C:/PROGRA1/R/R-2151.2/bin/x64/R" --vanilla CMD INSTALL
"C:\Users\axcv\AppData\Local\Temp\RtmpS6qBes\devtools2aa032eb21bc\clickme-master"
--library="C:/Program Files/R/R-2.15.2/library" --install-tests
installing source package 'clickme' ...
** R
** data
** inst
** tests
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
*** arch - i386
*** arch - x64
DONE (clickme)
Reloading installed clickme
library(clickme)
clickme(points, rnorm(100))
Error in .walkClassGraph(classDef, "subclasses", where) :
the 'subClass' list for class “Chart”, includes an undefined class “Points”
Error in setClass(Class, contains = superClasses, where = where, ...) :
error in contained classes ("Chart") for class “Heatmap”; class definition removed from ‘.GlobalEnv’
if .clickme_env$root_path is null and CLICKME_ROOT_PATH is a valid path, use CLICKME_ROOT_PATH.
I changed translator.R to handle lists also through rjson and added the lifelines example as shown here.
I have never done a pull request. Would this be appropriate?
It will be like the runShiny function, copy a set of folders to opts$path$ractives
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.