.libPaths(blah) does nothing
<p>Apologies if someone has asked this before.  I've tried Googling and Googling, but no one seems to have reported quite this.  I'm trying to add a path to my <code>.libPaths</code>, but <code>.libPaths(new=blah)</code> doesn't seem to alter anything.  Here is my code:</p>

<pre><code>packagedir = paste0(getwd(),'/extraRPackages/')
newLibPaths = c(packagedir,.libPaths())
print(newLibPaths)
.libPaths(newLibPaths)
print(.libPaths())
</code></pre>

<p>...here is the output from the first print (what I'm passing into <code>.libPaths</code>):</p>

<pre><code>[1] "C:/Users/GCW/Dropbox/Mash share/Phil/R/mashdb/database/extraRPackages/"
[2] "C:/Users/GCW/Documents/R/win-library/3.3"                              
[3] "C:/Program Files/R/R-3.3.1/library"
</code></pre>

<p>... and the second print:</p>

<pre><code>[1] "C:/Users/GCW/Documents/R/win-library/3.3" "C:/Program Files/R/R-3.3.1/library"    
</code></pre>

<p>Why might my call to .libPaths(new=blah) do absolutely nothing??  I'm stumped!  I've tried it in RStudio and RPortable, but both give me the same output...  Any help v much appreciated...</p>

<p>(I know from reading other answers that there are "proper" ways to change the paths permanently, but this is something I want to be able to do dynamically in a rather unusual setup, and if .libPaths just did what I thought it would, I'd be done...)</p>

<p>EDIT: It was suggested that this might be a duplicate of this question <a href="https://stackoverflow.com/questions/15170399">Changing R default library path using .libPaths in Rprofile.site fails to work</a> -- but I don't think it is.  I read this question before posting my own -- but in this question, it says at the end that "if I start RStudio the .libPaths() command seems to work as it is supposed to" -- but it is precisely in RStudio that the command doesn't do anything for me (and this is where I want to use it, not in the RProfile.site file and not in any permanent way)....</p>