rstudio / r2d3

R Interface to D3 Visualizations
https://rstudio.github.io/r2d3
Other
516 stars 105 forks source link

Example of 0.2.2 barchart is not found #38

Open chriswiduta opened 6 years ago

chriswiduta commented 6 years ago

Im getting an error running the example from https://rstudio.github.io/r2d3/: r2d3(data=c(0.3, 0.6, 0.8, 0.95, 0.40, 0.20), script = "barchart.js")

Error: barchart is not defined ReferenceError: barchart is not defined

The above code was found straight from the docs. I did however have a r2d3 0.2 installed on a second computer. Running the following still works and displays the demo graph.
r2d3(data=c(0.3, 0.6, 0.8, 0.95, 0.40, 0.20), script = system.file("examples/barchart.js", package = "r2d3"))

javierluraschi commented 6 years ago

@chriswiduta right, we thought it was more clear to show only script = "barchart.js" since it assumes you will have to create your own script, but as you point out, system.file("examples/barchart.js", package = "r2d3") would be the correct way of running this example.

If we get more feedback than script = "barchart.js" is confusing, we can change this in the docs. I'll leave this issue open for a bit longer before making a change.

freshforlife commented 5 years ago

I'm having the same issue as above. Running with the 2nd script works fine.