How to unlock environment in R?

后端 未结 1 2038
醉酒成梦
醉酒成梦 2020-12-11 15:02

Playing with Binding and Environment Adjustments in R , we have this 3 functions:

  1. lockEnvironment(env) locks env so you can\'t add a new symbol to
相关标签:
1条回答
  • 2020-12-11 15:41

    I think the best you can do is make a new unlocked environment. You could either copy all the fields, or make the existing one a parent of the new one. That means all the existing variables get inherited.

    unlockEnvironment <- function (env) {
      return (new.env(parent=env))
    }
    
    e <- unlockEnvironment(e)
    
    0 讨论(0)
提交回复
热议问题