Hi, I have a very simple question. If a want to save a whole program (say more than 5 command lines), how can I proceed without each time using the command history (that allow me to recall previously saved command, but which is to long if you want to recall more than 5 command lines), or without saving to a text file and use copy/paste when I open a new R session (but in fact this doesn't work since when you copy your program to a text file, you copy the "<" or the "+" , and when you paste it back to a new R command sheet, you get syntax error since you now have double "<" (<<) and double "+" (++) at each line. Do they have something simple like in any other program, that consist of saving the command sheet under say Program X. Program X will become a simple file that I can reopened any time I want and each time I open it, I will have in front of me all the previous saved command, (including error, I don't care), in order that I don't have to recall anything when the program X is opened. Thanks Marc-Antoine Vaillant Actuarial Analyst Les Services actuariels SAI inc. [[alternative HTML version deleted]]
Hi, On Thu, 13 Nov 2003, Marc-Antoine Vaillant wrote:> I have a very simple question. If a want to save a whole program (say more than 5 command lines), how can I proceed without each time using the command history (that allow me to recall previously saved command, but which is to long if you want to recall more than 5 command lines), or without saving to a text file and use copy/paste when I open a new R session (but in fact this doesn't work since when you copy your program to a text file, you copy the "<" or the "+" , and when you paste it back to a new R command sheet, you get syntax error since you now have double "<" (<<) and double "+" (++) at each line.Please wrap your text to something like 80 character per line... Copy/paste works very well. Instead of copying from your R session over to a text editor, why don't you do it the other way round? i.e. type your R codes in your favourite editor, THEN copy/paste into R. That way you don't get any syntax error, and you have all your R codes saved into one file. There are several good tools. (X)Emacs/ESS is one of them (and it's the one I prefer). For beginners there is RWinEdt (a plugin, written by Uwe Ligges, for WinEdt). Both allows direct communication from the editor to R.... HTH. -- Cheers, Kevin --------------------------------------------------------------- "Try not. Do, do! Or do not. There is no try" Jedi Master Yoda ---- Ko-Kang Kevin Wang Master of Science (MSc) Student SLC Tutor and Lab Demonstrator Department of Statistics University of Auckland New Zealand Homepage: http://www.stat.auckland.ac.nz/~kwan022 Ph: 373-7599 x88475 (City) x88480 (Tamaki)
I think you are looking for savehistory(), or the equivalent on the menus under GUI systems. But, R is a program, and although I think you mean a section of R code, I do not know exactly what you intend `program'to mean. If you mean a function, see dump(). On Thu, 13 Nov 2003, Marc-Antoine Vaillant wrote:> I have a very simple question. If a want to save a whole program (say > more than 5 command lines), how can I proceed without each time using > the command history (that allow me to recall previously saved command, > but which is to long if you want to recall more than 5 command lines), > or without saving to a text file and use copy/paste when I open a new R > session (but in fact this doesn't work since when you copy your program > to a text file, you copy the "<" or the "+" , and when you paste it back > to a new R command sheet, you get syntax error since you now have double > "<" (<<) and double "+" (++) at each line. > > Do they have something simple like in any other program, that consist of > saving the command sheet under say Program X. Program X will become a > simple file that I can reopened any time I want and each time I open it, > I will have in front of me all the previous saved command, (including > error, I don't care), in order that I don't have to recall anything when > the program X is opened.-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
On 14 Nov 2003 at 8:14, Ko-Kang Kevin Wang wrote:> Hi, > > On Thu, 13 Nov 2003, Marc-Antoine Vaillant wrote: > > > I have a very simple question. If a want to save a whole program (say more than 5 command lines), how can I proceed without each time using the command history (that allow me to recall previously saved command, but which is to long if you want to recall more than 5 command lines), or without saving to a text file and use copy/paste when I open a new R session (but in fact this doesn't work since when you copy your program to a text file, you copy the "<" or the "+" , and when you paste it back to a new Rcommand sheet, you get syntax error since you now have double "<" (<<) and double "+" (++) at each line.> > Please wrap your text to something like 80 character per line...Or even a little bit less ...> > Copy/paste works very well. Instead of copying from your R session over > to a text editor, why don't you do it the other way round? i.e. type your > R codes in your favourite editor, THEN copy/paste into R. That way you > don't get any syntax error, and you have all your R codes saved into one > file. > > There are several good tools. (X)Emacs/ESS is one of them (and it's the > one I prefer). For beginners there is RWinEdt (a plugin, written by Uwe > Ligges, for WinEdt). Both allows direct communication from the editor to > R....Yes. But sometimes one wants to experiment, then it is usefull to have options(continue=" ") Kjetil Halvorsen> > HTH. > > -- > Cheers, > > Kevin > > --------------------------------------------------------------- > "Try not. Do, do! Or do not. There is no try" > Jedi Master Yoda > > ---- > Ko-Kang Kevin Wang > Master of Science (MSc) Student > SLC Tutor and Lab Demonstrator > Department of Statistics > University of Auckland > New Zealand > Homepage: http://www.stat.auckland.ac.nz/~kwan022 > Ph: 373-7599 > x88475 (City) > x88480 (Tamaki) > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help