1

Rather than trying to use:

R < filename.r --vanilla

You can load prewritten code with

source ('filename.R')

This can also be added to an .RProfile file if it needs to be loaded each time.

user2589273
  • 2,379
  • 20
  • 29
  • 1
    Use `Rscript filename.r` or `R CMD BATCH filename.r`. You can have some details on `Rscript` by execuiting `Rscript --help`. – nicola Oct 29 '14 at 14:51
  • @nicola I am not struggling with the execution, I want to keep the interactivity of R in terminal, just want to load a few lines of preamble (like adding the correct libraries and defining constants) rather than retyping it each time and then continue as you do when you just open the R interpreter. – user2589273 Oct 29 '14 at 18:30
  • 2
    If that is your problem, you can write a `.Rprofile` file in your directory and it will be executed at the start of your R session. See for example http://www.statmethods.net/interface/customizing.html – nicola Oct 29 '14 at 21:17

0 Answers0