Editing R Source Files



Use notepad to edit external files. One can invoke the notepad editor using the command

  system("notepad file.R",wait=FALSE);

to invoke notepad and edit a file file.R. or

  system("notepad",wait=FALSE);

to just invoke the notepad editor.

Don't use the edit(...) command from the command line -- it doesn't work properly.

R source files are typically stored with a .R extension.

Multiple files can be edited by invoking multiple instances of notepad using the command above.

One can view external files using the command file.show('filename'), or within the windows GUI one can view files by selecting the File/Display file item from the menu bar.

If notepad saves files with an extension .R.txt
:

You can pass the name of the file to edit in the system command, or, associate .R files with the notepad program. To create an association, bring up a DOS command window and execute the command

C>assoc .R=notepad

Original Documentation : system, file.show

Samples

  system("notepad myfile.R",wait=FALSE);  # invoke notepad as the editor for the file myFile.R

  system("notepad",wait=FALSE);           # invoke notepad as the editor

  file.show('myfile.R')                   # displays the file myfile.R in a separate window

UCLA Mathematics Department ©2000