3

Let's say I have just run a large linear regression that has taken a considerable amount of time to run. However, I forgot to assign the model to a variable prior to running it, i.e. lm(outcome ~ iv1 + iv2)

Instead of

fit <- lm(outcome ~ iv1 + iv2)

Is there a way to retroactively assign the final output to a variable after its been run?

M--
  • 25,431
  • 8
  • 61
  • 93
Parseltongue
  • 11,157
  • 30
  • 95
  • 160

1 Answers1

8

If you have not run anything else in the interim, the last object created is stored in .Last.value.

fit <- .Last.value
the-mad-statter
  • 5,650
  • 1
  • 10
  • 20