<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/where-am-i/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://www.johnmackintosh.com/2018-09-23-Where-am-I/"> HighlandR</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>	Notes on the here package – </p>
<p>The here package is pretty simple ( only 3 functions), but I cannot remember how to use it to navigate folders, so this is my aide-memoire.<br>
It might be useful for others too.</p>
<p>Here finds the root of your current folder / working directory.<br>
If you use Projects in RStudio, that will usually be the root of your project folder.<br>
If not, you can use set_here() to create a small file which will set the root location.</p>
<div>
<div>
<pre><code><span>
</span><span># where am I in my computer?</span><span>
</span><span>here</span><span>()</span><span>
</span><span>&quot;C:/Users/some/path/or/other&quot;</span><span>
</span><span>#</span><span>
</span><span># create a folder</span><span>
</span><span>dir.create</span><span>(</span><span>here</span><span>(</span><span>&quot;img&quot;</span><span>))</span><span>
</span><span>&quot;C:/Users/some/path/or/other/img&quot;</span><span>
</span><span>dir.create</span><span>(</span><span>here</span><span>(</span><span>&quot;img&quot;</span><span>,</span><span>&quot;png&quot;</span><span>))</span><span>
</span><span>&quot;C:/Users/some/path/or/other/img/png&quot;</span><span>
</span><span>#move to the outputs folder using setwd()</span><span>
</span><span>setwd</span><span>(</span><span>here</span><span>(</span><span>&quot;img&quot;</span><span>))</span><span>
</span><span># check this worked - get the current working directory with getwd()</span><span>
</span><span>getwd</span><span>()</span><span>
</span><span>&quot;C:/Users/some/path/or/other/img&quot;</span><span>
</span><span># go back to the root of the project</span><span>
</span><span>setwd</span><span>(</span><span>here</span><span>())</span><span>
</span><span>#check you are back where you started</span><span>
</span><span>getwd</span><span>()</span><span>
</span><span>&quot;C:/Users/some/path/or/other&quot;</span><span>
</span></code></pre>
</div>
</div>
<p>Now the next time I am like this:</p>
<p>¯_(ヅ)_/¯</p>
<p>I can just read this post, and hope no-one sees me reading my own blog.</p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://www.johnmackintosh.com/2018-09-23-Where-am-I/"> HighlandR</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/LgGYAHCtmL4" height="1"></a></div>