Code Monkey home page Code Monkey logo

Comments (9)

dmbates avatar dmbates commented on July 18, 2024

I don't think the example is reproducible so I will ask you to try

rprint(rcall(:stars,myDF;draw.segments=true))

to see if that works. In Julia named arguments are allowed only after the ; separator.

from rcall.jl.

simonbyrne avatar simonbyrne commented on July 18, 2024

actually the separator is only required for definitions, you don't need it for calling

from rcall.jl.

mbeltagy avatar mbeltagy commented on July 18, 2024

I tried it and it did not work. I got the same error

rprint(rcall(:stars,myDf;draw.segments=true))
ERROR: syntax: keyword argument is not a symbol: "draw.segments"

The trouble appears to be with draw.segments. Julia seems to be having trouble passing it along to R. In Julia, I have never come across keyword arguments with attributes as in R.

from rcall.jl.

simonbyrne avatar simonbyrne commented on July 18, 2024

@mbeltagy I don't yet have a good way to handle that case.

from rcall.jl.

randy3k avatar randy3k commented on July 18, 2024

It is one of the ways to mimic this, certainly not a good way.

eval(:(rcall(:stars,:mtcars,$(symbol("draw.symbol"))=true)))

It may be also of interest to implement a @rcall macro to handle non-standard keywords and lazy evaluation #42.

from rcall.jl.

mbeltagy avatar mbeltagy commented on July 18, 2024

It works!

 eval(:(rcall(:stars,:mtcars,$(symbol("draw.segments"))=true)))

The syntax is a bit cumbersome though. I look forward to an @rcall macro.

from rcall.jl.

simonbyrne avatar simonbyrne commented on July 18, 2024

A neat hack I once came across somewhere (I don't remember where). Define the following:

macro var_str(s)
    symbol(s)
end

then the following should work:

rprint(rcall(:stars,myDF;var"draw.segments"=true))

from rcall.jl.

simonbyrne avatar simonbyrne commented on July 18, 2024

I would be okay with incorporating something along these lines. Any suggestions for a good prefix? r, s, and v are all taken by various uses in Base (which, unfortunately, are the 3 most relevant in this case).

from rcall.jl.

simonbyrne avatar simonbyrne commented on July 18, 2024

I've added the above macro, so hopefully that is a reasonable solution.

from rcall.jl.

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.