'Closing an RStudio project programmatically

The rstudioapipackage has a function openProject() with which one can non-interactively open an existing R Studio project.

In fact, there are functions in the same package for initializing/creating R Studio projects. However, I could not find anything in the documentation for closing or shutting down a project and moving into a regular R session.

How can this be done, if at all?



Solution 1:[1]

I realize this is old, but for those still looking, there is a function now using the rstudioapi package:

rstudioapi::executeCommand('closeProject')

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 coip