Using get inside lapply, inside a function

前端 未结 3 748
萌比男神i
萌比男神i 2020-12-16 01:09

this may seem like a overly complicated question, but it has me driving me a little nuts for some time. It is also for curiosity, because I already have a way of doing what

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-16 01:34

    Just convert the current environment into a list:

    foo <- function(a=1, b=5, h='coconut') {
      as.list(environment())
    }
    foo(a = 0, h = 'mango')
    

提交回复
热议问题