Need help resetting R dataset to it's original form

I am using the Credit dataset within the ISLR package in R. I was using the dataset and accidentally modified it creating new variables within it and messing up a variable it already had. Now when I run head(Credit) I get the modified dataset with all of my mistakes (the variable I altered and the variables I created all return "<data.frame [6 × 1]> " now. I have tried reloading the dataset, rerunning it, removing the new variables from my environment, and uninstalling the ISLR package and then reinstalling it. Nothing is working. Please help if you have any idea how I could fix this, I can't find anything on the internet that works.

You can use the built-in (from the utils package, which is part of base R) data() function (see all arguments etc. at link, or by running ?data in your R console).

You'll want to use the overwrite argument (specify as TRUE) to make sure that you're overwriting whatever is in your environment with the original dataset from the package.

also, you can restart R Studio using Ctrl Shift and F10. I have options for saving workspace at project and globalblevel turned off so its very convenient to go back to a blank slate environment with that keyboard shortcut.

2 Likes

This topic was automatically closed 21 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.