Simple ``one-liner'' functions can be typed in at the command line. However, they are destroyed when the RLaB session is ended. Most users will want to create their functions in a text-editor as ordinary ASCII files.
The function load
will execute the RLaB statements in a
file as if they were typed at the command line. The RLaB command
rfile
searches a specified path for files with a `.r'
extension. When the rfile
command finds a file that matches
its argument, it executes the RLaB statements in the file as if
they were typed at the command line.
Statements in a file are executed in the same manner as they would be had they been typed in interactively. Files containing ordinary commands and multiple functions are acceptable. In fact, complete programs can be written and run interactively or in batch mode. To run a program in batch mode you can try:
% rlab program.r &
Or the program could contain #!/usr/local/bin/rlab
on the
first line. Then, if your operating system provides the proper
support, RLaB can execute your program, interactively, or in the
background by simply typing:
$ chmod +x program.r $ ./program.r