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
with() to select specific values from a data frame and then plot these.