Is there an analogue of common lisp "*" variable which contains the value of the last expression? E.g., in lisp:> (+ 1 2)3> *3 I wish I could recover the value of the last expression without re-evaluating it. thanks -- Sam Steingold (http://sds.podval.org/) on Ubuntu 11.10 (oneiric) X 11.0.11004000 http://www.childpsy.net/ http://camera.org http://ffii.org http://truepeace.org http://memri.org http://americancensorship.org The early bird may get the worm, but the second mouse gets the cheese.
.Last.value On Thu, Feb 9, 2012 at 9:44 PM, Sam Steingold <sds@gnu.org> wrote:> Is there an analogue of common lisp "*" variable which contains the > value of the last expression? > E.g., in lisp: > > (+ 1 2) > 3 > > * > 3 > > I wish I could recover the value of the last expression without > re-evaluating it. > > thanks > > -- > Sam Steingold (http://sds.podval.org/) on Ubuntu 11.10 (oneiric) X > 11.0.11004000 > http://www.childpsy.net/ http://camera.org http://ffii.org > http://truepeace.org http://memri.org http://americancensorship.org > The early bird may get the worm, but the second mouse gets the cheese. > > ______________________________________________ > R-help@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<http://www.r-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]
The "right answer" is .Last.value but I find that far too much to type so I have the following in my .Rprofile makeActiveBinding("ans", function().Last.value, .GlobalEnv) which sets the variable "ans" to be the last value. Michael On Thu, Feb 9, 2012 at 9:44 PM, Sam Steingold <sds at gnu.org> wrote:> Is there an analogue of common lisp "*" variable which contains the > value of the last expression? > E.g., in lisp: >> (+ 1 2) > 3 >> * > 3 > > I wish I could recover the value of the last expression without > re-evaluating it. > > thanks > > -- > Sam Steingold (http://sds.podval.org/) on Ubuntu 11.10 (oneiric) X 11.0.11004000 > http://www.childpsy.net/ http://camera.org http://ffii.org > http://truepeace.org http://memri.org http://americancensorship.org > The early bird may get the worm, but the second mouse gets the cheese. > > ______________________________________________ > 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.