Is there a way to create multiple environments in the console?

Frequently, in RStudio, in a markdown file, I find myself doing command-shift-enter to run the current chunk. This pollutes the global R environment.

Is there anyway I can create a 'current environment' or 'live environment' so that anything that gets run in the console gets attached to that environment and not to the global one?

If you are not familiar with them, it sounds like you want to explore how projects work

Though on a Mac you can also open a new environment from the RStudio icon in the dock

1 Like