| withAs | R Documentation |
An alternative to the with function in base R where data is represented by a temporary variable within a new environment rather than evaluating expr directly within data. This can help explicitly show which variables are contained within data from those outside.
withAs(..., expr = NULL)
... |
data to be used in expression. Argument names are used as temporary variable names. So |
expr |
expression to evaluate. if expr is not defined by name then the last unnamed argument is used. |
the value of the evaluated expr
d<-3:12
longNameDataFrame<-data.frame('a'=1:10,'b'=2:11)
with(longNameDataFrame,a+b+d)
withAs(xx=longNameDataFrame,xx$a+xx$b+d)
anotherDf<-data.frame('c'=3:12)
withAs(xx=longNameDataFrame,zz=anotherDf$c*10,xx$a+xx$b+zz)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.