Guest User

Untitled

a guest
Jan 10th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. detach("new_tmp")
  2. attach(new.env(), name="new_tmp")
  3. my_newenv <- as.environment("new_tmp")
  4. source("C:/Users/tmp/tmp.R", local=my_newenv)
  5. search()
  6.  
  7. xxx <- "this should not be overwritten"
  8. y <- 10
  9.  
  10. my_newenv$printing_func(10) # the result should be 20!
  11. print(my_newenv$xxx)
  12.  
  13. # <<< R script imported using source() function >>>
  14. # >>>
  15. # >>>
  16. xxx <- "this overwrote"
  17. printing_func <- function(xx){
  18. xx + y
  19. print("it works")
  20. }
Add Comment
Please, Sign In to add comment