Hello All, In bash, to re-execute a command, say, 'gnuplot plot.gnu', one can type !gnu. Is there a similar feature in the R console? For example: plot(g1$mean,g2$mean) . . . Lines, many lines of commands ->Here I want to repeat the previous plot command. !plot and plot(+TAB) do not work. This question was asked in this forum back in 2006 but the answer seems to have been lost somewhere in their discussions. This is the thread http://n4.nabble.com/R-command-line-need-intelligent-command-history-recall-td793072.html#a793075 . Can some one comment if there is a way to do it? Thank you, MoonStone -- View this message in context: http://n4.nabble.com/Re-execute-previous-command-tp1474629p1474629.html Sent from the R help mailing list archive at Nabble.com.
On Feb 9, 2010, at 11:21 AM, mnstn wrote:> > Hello All, > In bash, to re-execute a command, say, 'gnuplot plot.gnu', one can > type > !gnu. Is there a similar feature in the R console? For example: > plot(g1$mean,g2$mean)In most system typeing <up-arrow> will prompt the console to echo the last command (and repeating the process will scroll back through "history".) There is also a .Last.value object but I don't know if it will "replot". -- David.> . > . > . > Lines, many lines of commands > ->Here I want to repeat the previous plot command. > !plot and plot(+TAB) do not work. > > This question was asked in this forum back in 2006 but the answer > seems to > have been lost somewhere in their discussions. This is the thread > http://n4.nabble.com/R-command-line-need-intelligent-command-history-recall-td793072.html#a793075 > . Can some one comment if there is a way to do it? > > Thank you, > MoonStone > -- > View this message in context: http://n4.nabble.com/Re-execute-previous-command-tp1474629p1474629.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.David Winsemius, MD Heritage Laboratories West Hartford, CT
On Feb 10, 5:21?am, mnstn <pavan.n... at gmail.com> wrote:> Hello All, > In bash, to re-execute a command, say, ?'gnuplot plot.gnu', one can type > !gnu. Is there a similar feature in the R console? For example: > plot(g1$mean,g2$mean) > . > . > . > Lines, many lines of commands > ->Here I want to repeat the previous plot command. > !plot and plot(+TAB) do not work. > > This question was asked in this forum back in 2006 but the answer seems to > have been lost somewhere in their discussions. This is the threadhttp://n4.nabble.com/R-command-line-need-intelligent-command-history-... > . Can some one comment if there is a way to do it? > > Thank you, > MoonStone > --In bash, you can also use Ctrl-R plot to see the previous plot command - then Ctrl-R repeatedly to cycle through them all. Ctrl-S to search forward on the same text. Press enter to execute the one you want - or edit, etc. This also works in the R console for me. -- Anita
You can use the history function to see a list of previous commands (but it does not automatically run them). Do> history(pat='plot')To get a list of all the commands that you ran that included the string 'plot' somewhere in it. You can then copy and paste to rerun (under the windows GUI (and possibly others) you can highlight and hit a button to rerun). Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow at imail.org 801.408.8111> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r- > project.org] On Behalf Of mnstn > Sent: Tuesday, February 09, 2010 9:21 AM > To: r-help at r-project.org > Subject: [R] Re-execute previous command > > > Hello All, > In bash, to re-execute a command, say, 'gnuplot plot.gnu', one can > type > !gnu. Is there a similar feature in the R console? For example: > plot(g1$mean,g2$mean) > . > . > . > Lines, many lines of commands > ->Here I want to repeat the previous plot command. > !plot and plot(+TAB) do not work. > > This question was asked in this forum back in 2006 but the answer seems > to > have been lost somewhere in their discussions. This is the thread > http://n4.nabble.com/R-command-line-need-intelligent-command-history- > recall-td793072.html#a793075 > . Can some one comment if there is a way to do it? > > Thank you, > MoonStone > -- > View this message in context: http://n4.nabble.com/Re-execute-previous- > command-tp1474629p1474629.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > and provide commented, minimal, self-contained, reproducible code.