I have a vector x <- rnorm(100)
and whilst exploring my data I do:
x
Now I want to look at the mean
of x, for which I could do:
mean(x)
But lets say instead I want to have a function last()
which pulls in the last thing done in Rs history and saves it as an object, which would enable me to do:
mean(last())
I'd like to write a last()
function if it doesn't already exist. But I cannot find a way to access (without saving and then reading back in) the history in any useful way via history()
.
Am I missing something?