I am trying to understand some code well enough that I can create the necessary files to make it run it for a client. I thought it was odd that it loads a library within a loop:
for (i in 1:length(ids) ){
library(limma)
# About 80 lines of code
}
Is there any likely reason that someone would want to reload the same library multiple times? I thought that libraries didn't do anything besides provide functions.
I searched the limma
user guide for the keywords "library" and "load" and didn't find anything obvious.
I would almost think this were an accident if it weren't the very first line in the loop.
It's a mistake. Change the library
call to library(limma, verbose=TRUE)
and you'll see that only the first call actually does anything (something is returned invisibly, but they're not using it because it's not being assigned).
For example:
> pkgs <- library(base, verbose=TRUE)
Warning message:
In library(base, verbose = TRUE) :
package ‘base’ already present in search()
> pkgs
# [1] "stats" "graphics" "grDevices" "utils" "datasets"
# [6] "setwidth" "colorout" "methods" "base"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With