[R] .Last.value (was <no subject>)

John Fox jfox at mcmaster.ca
Sat Jan 10 02:37:50 CET 2009


Dear Sarah and Glenn,

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On
> Behalf Of Sarah Goslee
> Sent: January-09-09 7:32 PM
> To: glenn
> Cc: r-help at r-project.org
> Subject: Re: [R] <no subject>
> 
> Hi Glenn,
> 
> On Fri, Jan 9, 2009 at 7:20 PM, glenn <g1enn.roberts at btinternet.com>
wrote:
> > Very simple questions if anyone can help:
> >
> > (1) what is the value in saving workspaces, which is offered at every
> close?
> > I thought it might save the set up of the GUI but I cant work out what
it
> > does - I run a script that loads the packages I need at the start of
every
> > session.
> 
> Saving  a workspace doesn't save the packages you have loaded, but
> does save your data in its current state, as well as any sourced
functions.
> Very useful if you have a bunch of work you don't want to reconstruct, or
> a simulation that just took three days to run.
> 
> > (2) mathematica has a term (%) that when typed means the last returned
> > value, so  >  % + 1 say would return the last outputted value +1 .is
there
> > an R equivalent please?
> 
> I don't think so - you need to assign that value to something to be able
> to reuse it.

Actually, you can access the last result:

> 1:10
 [1]  1  2  3  4  5  6  7  8  9 10

> 1 + .Last.value
 [1]  2  3  4  5  6  7  8  9 10 11

> a <- 5

> 1 + .Last.value
[1] 6

Regards,
 John

> 
> Sarah
> 
> --
> Sarah Goslee
> http://www.functionaldiversity.org
> 
> ______________________________________________
> 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.




More information about the R-help mailing list