R substitute on expression with assignment
W开发者_JS百科hy do these two cases behave differently?
>substitute(c1<-100,list(c1=100))
100 <- 100
vs
> substitute(c1=100,list(c1=100))
[1] 100
As I understand help to assignOps operator = evaluates immediately. So the second expression is equivalent to substitute(100,list(c1=100)).
But you could take it in braces and the result is
> substitute({c1=100},list(c1=100))
{
100 = 100
}
Because the second expression interprets c1 = 100 as saying the argument named c1 of the function substitute should have value 100.
加载中,请稍侯......
精彩评论