vadr
vadr copied to clipboard
"calling" anaphor
There needs to be something to deal with using multiple-argument functions in a chain, where more than one argument depends on the data. For example, to attach fitted values to a data frame:
chain(df,
lm(y~x),
calling(cbind, predict(se.fit=TRUE), .$data))
Here "calling" would chain first arg (.) into each of predict(se.fit=TRUE)
and .$data
, then apply to second arg (cbind) If second arg is a call, injects arguments, so could also be written:
chain(df,
lm(y~x),
calling(cbind(df), predict(se.fit=TRUE)))
Think of alternate syntaxes too.