Hi All, in my R programs I use different libraries to work with Excel sheets, i. e. xlsx, excel.link.
When running chunks of code repeatedly and not always in the order the program should run for development purposes I ran into trouble. There were conflicts between the methods within these functions causing R to crash. I thought about defining functions for the different task and calling the libraries locally to there functions. Doing this test -- cut -- f_test <- function() { library(xlsx) cat("Loaded packages AFTER loading library") print(search()) } cat("Loaded packages BEFORE function call ----------------------------") search() f_test() cat("Loaded packages AFTER function call -----------------------------") search() -- cut -- showed that the library "xlsx" was loaded into the global environment and stayed there although I had expected R to unload the library when leaving the function. Thus confilics can occur more often. I had a look into ?library and saw that there is no argument telling R to hold the library in the calling environment. How can I load libraries locally to the calling functions? Kind regards Georg ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.