How do I substitute symbols in a language object?

后端 未结 3 987
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-11 07:05

Suppose I have the following language object:

lang <- quote( f(x=a) )

and I want to substitute in 1 for a. How

3条回答
  •  心在旅途
    2020-12-11 08:00

    You can use substituteDirect rather than substitute:

    substituteDirect(lang, list(a=1))
    

    Eventually you may be able to use substitute. According to ?substituteDirect:

    The goal is to replace this with an eval= argument to substitute.

提交回复
热议问题