how to save variable in R
You can do that in R with the save() function. This can be invoked from the pull down menus under the âFileâ option by selecting âSave Workspaceâ. Using the pull down menu, R appears to assign the default file extension of .RData.hen, you run a new script file in which you planned to define another object as X1, then use X1 as an independent variable in a regression model. If you made a typo in your script file, and called the object x1 instead of X1, then run the regression, R will just use the previously defined X1 (if it can).