Advertisement
Guest User

Untitled

a guest
Nov 21st, 2014
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1.  
  2. a <- 1
  3. b <- 1
  4.  
  5. save(list = ls(), file = file.path(tempdir(), 'tmp.RData'))
  6.  
  7.  
  8. rm(list =ls())
  9.  
  10. load(file.path(tempdir(), 'tmp.RData'))
  11. ls()
  12.  
  13. rm(list =ls())
  14. library(magrittr)
  15.  
  16. # tempdir() %>% file.path("tmp.RData") %>% load(envir = parent.frame(3))
  17. # ls()
  18. testFunction <- function()
  19. {
  20. tempdir() %>% file.path("tmp.RData") %>% load(envir = parent.frame(3))
  21. print(ls())
  22. }
  23. testFunction2 <- function()
  24. {
  25. testFunction()
  26. print(ls())
  27. }
  28.  
  29. testFunction3 <- function()
  30. {
  31. testFunction2()
  32. print(ls())
  33. }
  34.  
  35. testFunction3()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement