GithubHelp home page GithubHelp logo

Comments (3)

mjskay avatar mjskay commented on June 13, 2024

I think this has to do with the fact that rlang's formula functions rely on ... and rfun() doesn't really support ... arguments that are rvars. So I think the bigger issue here might be to allow rfun() to support ... arguments.

Relatedly, I'd recommend against using the formula functions these days anyway, since it does not work everywhere... I would use the new short-form lambda notation from base R instead (e.g. \(x) x^2). Maybe we should deprecate the formula notation wherever we support it in {posterior}? I don't think we're consistent about it anyway.

Last minor point: I'm not sure if ~ . ^ 2 was just for the sake of an example, but as with sin (#290), ^ has an implementation for the rvar class, so it will always be faster to use it directly; e.g. rvar(1:10) ^ 2 or f <- function(x) x ^ 2; f(rvar(1:10))

from posterior.

ksvanhorn avatar ksvanhorn commented on June 13, 2024

Thanks. I wasn't familiar with the new short-form lambda notation, and I didn't know that there were rvar implementations for sin and ^. I looked at the documentation for posterior::rvar() and looked at the list of functions you get with help(package=posterior), but I overlooked the section in the rvar vignette that lists all these math functions on rvars.

If I use (x)x^2 instead of ~.^2, everything works just fine.

from posterior.

mjskay avatar mjskay commented on June 13, 2024

If I use (x)x^2 instead of ~.^2, everything works just fine.

Great!

I looked at the documentation for posterior::rvar() and looked at the list of functions you get with help(package=posterior), but I overlooked the section in the rvar vignette that lists all these math functions on rvars.

Yeah, we probably should advertise math function support more clearly.

from posterior.

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.