[R] last result

Nick Matzke matzke at berkeley.edu
Sat Jan 24 01:19:55 CET 2009


Thanks!!!  Best R list ever...
Cheers,
Nick


Barry Rowlingson wrote:
> 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
> 

-- 
====================================================
Nicholas J. Matzke
Ph.D. student, Graduate Student Researcher
Huelsenbeck Lab
Center for Theoretical Evolutionary Genomics
4151 VLSB (Valley Life Sciences Building)
Department of Integrative Biology
University of California, Berkeley

Lab websites:
http://ib.berkeley.edu/people/lab_detail.php?lab=54
http://fisher.berkeley.edu/cteg/hlab.html
Dept. personal page: 
http://ib.berkeley.edu/people/students/person_detail.php?person=370
Lab personal page: http://fisher.berkeley.edu/cteg/members/matzke.html
Lab phone: 510-643-6299
Dept. fax: 510-643-6264
Cell phone: 510-301-0179
Email: matzke at berkeley.edu

Mailing address:
Department of Integrative Biology
3060 VLSB #3140
Berkeley, CA 94720-3140

-----------------------------------------------------
"[W]hen people thought the earth was flat, they were wrong. When people 
thought the earth was spherical, they were wrong. But if you think that 
thinking the earth is spherical is just as wrong as thinking the earth 
is flat, then your view is wronger than both of them put together."

Isaac Asimov (1989). "The Relativity of Wrong." The Skeptical Inquirer, 
14(1), 35-44. Fall 1989.
http://chem.tufts.edu/AnswersInScience/RelativityofWrong.htm




More information about the R-help mailing list