title: Fastest way to drive a vector of library packages given the vector of packages' names
body: <p>I am currently trying to see if there is a fast way to apply <code>library()</code> into a vector of string elements so that the final vector would result in a list of library of each package. For example, if I have a vector <code>c(&quot;base&quot;, &quot;dplyr&quot;, &quot;parallel&quot;, &quot;RPostgresSQL&quot;, &quot;DBI&quot;, &quot;rlang&quot;)</code>, and I want to obtain a vector <code>c(library(&quot;base&quot;), library(&quot;dplyr&quot;), library(&quot;parallel&quot;), library(&quot;RPostgresSQL&quot;), library(&quot;DBI&quot;), library(&quot;rlang&quot;)).</code> My goal is to put this vector of library into <code>clusterEvalQ()</code> so that each cluster node can have all the packages to execute the function <code>clusterMap().</code></p>
  <p><strong>My attempt.</strong></p>
  <pre><code>lib.list &lt;- unlist(lapply(c(&quot;base&quot;, &quot;dplyr&quot;, &quot;parallel&quot;, &quot;RPostgresSQL&quot;, &quot;DBI&quot;, &quot;rlang&quot;)), function(x) paste0('library(',as.character(x), )')) --- only gives me the vector of each string-type library (e.g. &quot;library(base)&quot;.)
  
  noquote(lib.list) --- Get rid of the annoying double-quote characters around &quot;library(base)&quot;.
  </code></pre>
  <p>I have two questions though:</p>
  <ol>
  <li>It seems to me that each time we execute the <code>clusterMap()</code>, we need to execute the <code>makeCluster()</code> to refresh each cluster node, if we update the variable <code>lib.list</code> in <code>clusterEvalQ(cl, lib.list)</code>? I tried executing only the <code>clusterMap()</code> but always ended up getting the same result, which does not make sense.</li>
  <li>Is there a faster way, in terms of execution time, to achieve the original goal?</li>
  </ol>