r - Why are = and <- not equivalent in within()? -
> within( list(a="a",b="b"), c="c" ) error in eval(expr, envir, enclos) : argument missing, no default > within( list(a="a",b="b"), c<-"c" ) $a [1] "a" $b [1] "b" $c [1] "c"
i'm not sure why these 2 shouldn't equivalent. seems the =
version getting interpreted argument named c
within because of ...
. there way disable behavior? tried,
within( list(a="a",b="b"), `c`="c" )
but fails too.
you correct c="c"
(or clause of form) getting interpreted supplied argument. , no, there's no way disable -- it's presumably handled down @ level of r parser.
this difference between =
, <-
documented ?"<-"
the operators ‘<-’ , ‘=’ assign environment in evaluated. operator ‘<-’ can used anywhere, whereas operator ‘=’ allowed @ top level (e.g., in complete expression typed @ command prompt) or 1 of subexpressions in braced list of expressions.
the prime example of "braced list of expressions" function body, can verify typing, e.g. is(body(plot.default))
, length(body(plot.default))
.
Comments
Post a Comment