代码之家  ›  专栏  ›  技术社区  ›  frankc

带赋值表达式上的R代换

r
  •  2
  • frankc  · 技术社区  · 16 年前

    为什么这两种情况表现不同?

    >substitute(c1<-100,list(c1=100))
    100 <- 100
    

    > substitute(c1=100,list(c1=100))
    [1] 100
    
    2 回复  |  直到 16 年前
        1
  •  2
  •   Marek    16 年前

    据我所知 assignOps 操作人员 = substitute(100,list(c1=100)) .
    但你可以把它放在大括号里,结果是

    > substitute({c1=100},list(c1=100))
    {
        100 = 100
    }
    
        2
  •  2
  •   Jonathan Chang    16 年前

    因为第二个表达式解释 c1 = 100 比如说 c1 函数的 substitute 值应该为100。