Search notes:

R function: with

In the following example, with() specifies a data frame on which an expression is executed. Thus, the need to prefix the column-names of the data frame with the name of the data frame is omitted:
df <- data.frame(foo=c(  1,  2,  3),
                 bar=c( 11, 22, 33),
                 baz=c(111,222,333))

sum(df$bar + df$baz)
# 732

with(
  df,
  sum(bar + baz)
)
# 732
Github repository about-r, path: /functions/with/sum.R

See also

Plotting a subset uses with() to select specific values from a data frame and then plot these.
attach()
within()
Index to (some) R functions

Index