Thank you @kevinushey, this answers my question.
@jim89 To answer you question. I'm trying to evaluate expressions without having to call a data.frame each time and still have the convenience of the auto-completion that rstudio offers. cf the exemple below using cars:
Exemple :
#1 - with with()
x <- with(cars, speed + dist)
#2 - with attach
attach(cars)
x <- speed + dist
detach(cars)
#3 - base R
x <- cars$speed + cars$dist
- In the first exemple the auto-completion doesnt work so it can be a bit tedious with long variables
- In the second exemple the auto-completion does work but it's hard to write and read with the name of the data being repeted each time
- In the third exemple, the auto-completion works and it is easy to read but it's usually considered bad practice to use "attach()" and can lead to mistakes.