title: Why is it not advisable to use attach() in R, and what should I use instead?
body: <p>Let's assume that we have a data frame <code>x</code> which contains the columns <code>job</code> and <code>income</code>. Referring to the data in the frame normally requires the commands <code>x$job</code>for the data in the <code>job</code> column and <code>x$income</code> for the data in the <code>income</code> column.</p>
  
  <p>However, using the command <code>attach(x)</code> permits to do away with the name of the data frame and the <code>$</code> symbol when referring to the same data. Consequently, <code>x$job</code> becomes <code>job</code> and <code>x$income</code> becomes <code>income</code> in the R code.</p>
  
  <p>The problem is that many experts in R advise NOT to use the <code>attach()</code> command when coding in R.</p>
  
  <p>What is the main reason for that? What should be used instead?</p>