[R] last result
Barry Rowlingson
b.rowlingson at lancaster.ac.uk
Fri Jan 23 23:50:12 CET 2009
2009/1/23 Jorge Ivan Velez <jorgeivanvelez at gmail.com>:
> See ?.Last.value
But don't do that right after you've done the calculation! You get
*one* chance with .Last.value:
# here comes my important numbers...
> runif(10)
[1] 0.7685472 0.2301233 0.3053993 0.5185696 0.3345997 0.1544350 0.2663696
[8] 0.3507546 0.5784584 0.8086018
# oops, forgot to save. Rescue me!
> .Last.value
[1] 0.7685472 0.2301233 0.3053993 0.5185696 0.3345997 0.1544350 0.2663696
[8] 0.3507546 0.5784584 0.8086018
# great.
# now lets do it again...
# important numbers...
> runif(10)
[1] 0.93327031 0.83386334 0.12700277 0.64945395 0.69035166 0.03204482
[7] 0.92048915 0.47846889 0.26652058 0.85651072
# hmmm lets check the help:
> ?.Last.value
# great. but now:
> .Last.value
>
it's gone! Oops.
Any typed expression that returns a value will stomp on .Last.value,
even if invisible (as returned from help()). Errors don't, so if you
can't remember if it's .Last.Value or .Last.value you're okay:
> runif(10)
[1] 0.9613436 0.5182666 0.1745280 0.5625401 0.7592582 0.6669713 0.2248729
[8] 0.3458498 0.3198318 0.9048984
> .Last.Value
Error: object ".Last.Value" not found
> .Last.value
[1] 0.9613436 0.5182666 0.1745280 0.5625401 0.7592582 0.6669713 0.2248729
[8] 0.3458498 0.3198318 0.9048984
If this all fails, cut n paste the text and do it the old fashioned way...
Barry
More information about the R-help
mailing list