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:
- locate the code you used to create dataframe
- 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
- 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
- rm() variables that should be IN the dataframe that you cavalierly created outside of it, like a numbnuts
- detach(dataframe) so package it back up
- rm(dataframe) to delete the whole goddamn thing (one iteration of it, that is)
- repeat steps 2-4 until you see no more iterations of the dataframe in your path
- re-create dataframe using code from step 1
- correct all code to include dataframe$ before variable names
- repeat all of your manipulations from step 2
- resist the temptation to attach() dataframes ever again