Beginner question R

Hi,
I have a really beginner R question. When i open R and run a project, i might be doing some analyses just for fun. But then I might want to focus on this course day 1. Is there a way of like doing different projects or settings? I would kind of prefer if my play around code does not conflict with other things i do and at the same time i want to be able to open different project as is, where i left them. Kind of confused question but we are all beginners at first :slight_smile:

all the best

Hi, yes we all need to start somewhere. :) I am not sure whether I follow completely but if you look at the top left there is a small icon which let’s you open up a new R script. Maybe that’s what you mean? Best, Dirk

This RStudio support article covers your question link.

If I understand correctly, you want to save the workspace in its respective working directory, then clear your environment, do the other project, reload the saved workspace, and resume.

#save the workspace in the current working dir
save.image()
#clear the env
rm(list=ls())
#load the workspace from the current working dir
load(".RData")

In general, it’s probably fine to save workspaces as outlined by @Tifa. However, OpenMx does not always cooperate with this strategy. On approximately 6 occasions over the last 14 years, OpenMx has changed internal model structures which meant that you could not restore old model results after you updated to a new version of OpenMx. Specifically for saving model results, we recommend using mxSave and mxRestore. This is especially helpful for saving the results of models that take a long time (e.g., days) to run. The help pages are linked in this post.