Git Product home page Git Product logo

Comments (4)

edgararuiz-zz avatar edgararuiz-zz commented on June 26, 2024

As a workaround, I save the script as a file using writeLines() and then read the resulting file in r2d3()

from r2d3.

javierluraschi avatar javierluraschi commented on June 26, 2024

@daattali this is already supported, am I missing something? The only change from the code above is using script instead of text:

my_r3_code <- "
// !preview r2d3 data=c(0.3, 0.6, 3, 0.95, 0.40, 0.20), width=600

var barHeight = Math.ceil(height / data.length);

svg.selectAll('rect')
  .data(data)
  .enter().append('rect')
    .attr('width', function(d) { return d * width; })
    .attr('height', barHeight)
    .attr('y', function(d, i) { return i * barHeight; })
    .attr('fill', 'steelblue');
"
r2d3(data = c(0.3, 0.6, 0.8, 0.95, 0.40), script = my_r3_code)

from r2d3.

daattali avatar daattali commented on June 26, 2024

If that's supposed to work, then yes, that's exactly what I was talking about!

But when I try to run that (Windows 7, R 3.5.2, r2d3 v0.2.3) I get an error

Error in dirname(script) : path too long

I didn't even think of trying that though because the documentation didn't sound like text rather than a script file would work. If this does work, it would be nice if the function documentation made that note.

from r2d3.

daattali avatar daattali commented on June 26, 2024

Update: I just installed the package from github for the latest dev version and I'm still seeing the same error. @javierluraschi are you sure the code you provided works for you? If so, something strange is going on.

from r2d3.

Related Issues (20)

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.