RStudio: How to undo a command I ran?

I'm shocked I've gotten this far in my learning of R without this question coming up already. And, I'm quite disappointed it wasn't addressed in the Google Data Analytics course I just finished.

I ran the clean_names() function from the janitor package in my desktop RStudio, against a personal xlsx file I loaded. It dutifully clean-up all the dirty column names. However, I don't like its choices.

How do I un-do that action, and put them all back the way they were?

This may sound silly but assuming your commands are in a script, erase clean_names() and run the script again.

If you typed clean_names() into the console, you're probably out of luck. That's one reason that the console is mostly for playing around and that things you want to keep should be in a script.

1 Like

if you used the console you can still get back the code in the history, then put it in a script and erase the clean_names() segment. It's a bit unpleasant but it's an option.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.