Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rstudio calls source() when saving script

Tags:

r

rstudio

I'm using Rstudio on my Mac OS 10.9.2. It was fine until I installed the new version 98.778. Whenever I try to save my script. It automatically calls source("myscript.R") for me, which is very annoying. I then re-installed the previous version, 98.501. The problem is still there. Anyone knows how to stop it?

Appreciate it.

like image 471
NewbieDave Avatar asked Apr 15 '14 04:04

NewbieDave


People also ask

What does source on Save do in RStudio?

When editing re-usable functions (as opposed to freestanding lines of R) you may wish to set the Source on Save option for the document (available on the toolbar next to the Save icon). Enabling this option will cause the file to automatically be sourced into the global environment every time it is saved.

How do I save source code in R?

You can save your script at any time (use Save in the File menu or the save shortcut, Ctrl+S or Cmd+S depending on your OS). After you've saved your work, close RStudio.

Where should you save your R script?

You can save your script by clicking on the Save icon at the top of the Script Editor panel. When you do that, a Save File dialog will open. The default script name is Untitled. R.

How do I run a whole script in RStudio?

In addition, in Rstudio you can run the entire script by pressing Ctrl + Shift + Enter without selecting any code. In addition, there is a shortcut to source the current script file ( Ctrl + Shift + s ), which runs the script without echoing each line.

How do I save a script in RStudio?

To save the script, you can either click on the blue save icon, use the keyboard commands Ctrl + S on Windows or Command + S on Mac OS or go to File > Save. This file will be open in RStudio the next time you reopen RStudio unless you click on the X on the file tab to close it. Viewing other files or data in RStudio

How do I create an R script in your studio?

Initial RStudio Interface View To add a script file, either click on the green plus button on the upper left in the tool bar and select R Script or go to File > New File > R Script or on Windows use the commands Ctrl + Shift + N. On Mac OS this should be Command + Shift + N. Adding an R Script via the Add File Icon

Which character encoding should I use in RStudio?

If in doubt about which encoding to use, use UTF-8, as it can encode any Unicode character. The RStudio source editor can read and write files using any character encoding that is available on your system: You can choose the encoding for reading with File : Reopen with Encoding, which will re-read the current file from disk with the new encoding.

How do I edit files outside the main RStudio window?

The RStudio IDE's Source Windows allow you to edit files outside the main RStudio window. This is useful for splitting your work among multiple monitors, or devoting more space to your editor. There are two ways to open a new source window: Pop out an editor: click the Show in New Window button in any source editor tab.


2 Answers

Are you sure "Source on save" box is unchecked?

enter image description here

like image 55
CHP Avatar answered Oct 16 '22 10:10

CHP


You probably have the "source on save" checkbox ticked (next to the save icon on the left hand side in the code editor, not for saving the Rproject) which does this. (Untick it to turn it off)

http://www.rstudio.com/ide/docs/using/source

like image 9
mathematical.coffee Avatar answered Oct 16 '22 10:10

mathematical.coffee