Giter Site home page Giter Site logo

Comments (4)

piccolbo avatar piccolbo commented on June 19, 2024

This is a function that can make a copy by value at least the first enclosing environment. A recursive version is left as an exercise for the reader, and may be too costly computationally. This may cover most use cases

protect = 
    function(x) {
        envx= environment(x)
        nenv = as.environment(as.list(envx))
        parent.env(nenv) = parent.env(envx)
        environment(x) = nenv
        x}

from plyrmr.

piccolbo avatar piccolbo commented on June 19, 2024

protect is now implemented, need to test more before closing

from plyrmr.

piccolbo avatar piccolbo commented on June 19, 2024

still broke

from plyrmr.

piccolbo avatar piccolbo commented on June 19, 2024
delta = 0
ff = function()function(x) x$carb + delta #two deep env created
p = do(input(mtcars), ff())
as.data.frame(p)
delta  =  100
as.data.frame(p)
p = do(input(mtcars), ff())
as.data.frame(p)

rejoice!
works also for where and select, not for mutate or transform. It may be the most we can do so I am going to close for now. If someone has an idea as to get the ... args of these other function evaluated in an environment of choice, please let me know.

from plyrmr.

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.