do not attach()

by Sofia

Note to self: DO NOT USE attach(). Do whatever it takes to avoid it.

I would up making a mess of my variables, to the point were the variables of the dataframe I was using were masking themselves four times over.

In case this happens in the future, to get out of the mess:

  1. locate the code you used to create dataframe
  2. figure out how you’ve manipulated the variables since you attached the dataframe they came from so you can run these transformations again later, so you can keep doing what you were supposed to be doing in the first place instead of messing up your Global Environment
  3. search() to look at what you currently have sitting in your path. you will see copies of the attached dataframe. the more copies, the more silly you were
  4. rm() variables that should be IN the dataframe that you cavalierly created outside of it, like a numbnuts
  5. detach(dataframe) so package it back up
  6. rm(dataframe) to delete the whole goddamn thing (one iteration of it, that is)
  7. repeat steps 2-4 until you see no more iterations of the dataframe in your path
  8. re-create dataframe using code from step 1
  9. correct all code to include dataframe$ before variable names
  10. repeat all of your manipulations from step 2
  11. resist the temptation to attach() dataframes ever again