7

 

 

Running Code from Files: Scripts

 

If you will be entering more than a small handful of commands, rather than simply typing them at the command prompt, it is prudent to use an editor to place them in a file. This allows you to fix any errors in your code without needing to retype all of your commands. It is also very useful if you are experimenting with some properties of a figure to get it just right; when you have it just the way you like, you can save your commands to a file so that you can easily reproduce or modify the figure again later.

Both R and MATLAB have built-in editors1 and ways to execute commands from their built-in editors and from files. Following standard computer terminology, a file (or editor window) containing some ...

Get R and MATLAB now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.