Coder Social home page Coder Social logo

Comments (3)

savemark avatar savemark commented on July 19, 2024

Nevermind, I did find a solution:

list2env(myfun, environment())
Deriv(f)
#function (x) 
#par * x^(par - 1)

I'll leave it here in case anyone else have the same problem.

from deriv.

sgsokol avatar sgsokol commented on July 19, 2024

Right. As the error message suggests, get() cannot use expression with $ or any subindexing to find an object. It must be a plain name like f in your second example.

from deriv.

sgsokol avatar sgsokol commented on July 19, 2024

After some reflexion, I have found a way to circumvent get() limitations and now (i.e. starting from v3.8.4) your example gives:

(fd<-Deriv(myfun$f))
# function (x) 
# par * x^(par - 1)
# <environment: 0x29034b8>
fd(3)
# [1] 6

Please feel free to report any problem with proposed solution.

PS. The version 3.8.4 is not on CRAN yet (as of this writing) but you can test it with usual

devtools::install_github("sgsokol/Deriv")

from deriv.

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.