vadr icon indicating copy to clipboard operation
vadr copied to clipboard

"calling" anaphor

Open crowding opened this issue 11 years ago • 0 comments

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.

crowding avatar Feb 14 '14 11:02 crowding