Mike Lawrence
Mike Lawrence

Reputation: 1701

Override R's assignment of .Last.value

In R, whenever a calculation completes without throwing an error, the result is automatically stored in a variable named .Last.value. Being a lazy typer, I'd like to change the name of that variable if possible, for example to ... Is this possible?

Upvotes: 2

Views: 41

Answers (1)

MrFlick
MrFlick

Reputation: 206401

You could use

delayedAssign("..", .Last.value)

That will look up the value of .Last.value when you use ..

5
# [1] 5
.. + 2
# [1] 7

Though it's pretty fragile relying on the value of .Last.value so I'm not sure how robust this is.

Upvotes: 3

Related Questions