Ryan Thompson Ryan Thompson - 1 year ago 84
R Question

In R, how to assign the result of the previous expression to a variable?

Suppose I'm using R's interactive console, and I've just done something like this:


That long-running command returns a value, and I've just realized that I wanted to assign that value to a variable instead of discard it. So how can I get that value without running the command again? Is there a command like this?

result = get_last_return_value()

Answer Source

.Last.value is an answer.

It was answered once but you have better title.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download