Skip to content
This repository was archived by the owner on Apr 23, 2018. It is now read-only.

r2d3 example crashes due to 'as.list.proto' #1

Open
chiphogg opened this issue Oct 2, 2012 · 4 comments
Open

r2d3 example crashes due to 'as.list.proto' #1

chiphogg opened this issue Oct 2, 2012 · 4 comments

Comments

@chiphogg
Copy link

chiphogg commented Oct 2, 2012

I'm having trouble with the r2d3 example:

p <- qplot(displ, hwy, data = mpg)
r2d3(p, "mpg.json")
r2d3(p + geom_smooth(), "mpg-smooth.json")

The trouble shows up with the second line, but I think it actually starts in the first: if you try executing print(p), you also get the crash.

In either case, the error is:

Error in as.list.proto(this, ...) : attempt to apply non-function

Curiously, this line (which seems to be ggplot2-only) works fine until r2d3 is loaded, as the following commands from R --vanilla demonstrate:

> library(ggplot2)
> qplot(displ, hwy, data = mpg)
> library(r2d3)
Loading required package: digest
> qplot(displ, hwy, data = mpg)
Error in as.list.proto(this, ...) : attempt to apply non-function
@chiphogg
Copy link
Author

chiphogg commented Oct 2, 2012

Also, this seems as good a place as any to say it: I was just about to start work on an R package of this name, trying to interface R to d3. Seems you beat me to the punch to grab this clever name! :)

@hadley
Copy link
Owner

hadley commented Oct 9, 2012

This is obviously still pretty experimental, so no guarantees anything works, sorry! Will hopefully get back to it soon.

@chiphogg
Copy link
Author

chiphogg commented Oct 9, 2012

I figured as much. Can't wait to see what you come up with!

In the meantime: have you seen polychart.js? It's a javascript implementation of the Grammar of Graphics, and it's based on d3. There (obviously) seems to be some overlap with your ideas about R and d3.

@mskyttner
Copy link

I am very excited about this package, but not skilled enough with R to figure out what to do about this issue. I tried just commenting out the function that seems to be the culprit in the r2d3/R/ggplot2.r file, i.e.

as.list.proto <- function(x, ...) x$as.list(...)

and after doing that I seem to be able to run r2d3 without getting that error message, but I don't really know what other things I'm breaking by doing that...

Anyhow this a superexciting package to watch, in my opinion! It would be so nice to get interactive ggplot visualization for the web from R through d3. What a dream to be able to generate interactive web dashboards from R connected to live data... all open source, free and high quality!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants