Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Since I think you're wanting to keep some relativity in your paths, and because you're using RStudio, I'll share one strategy that I often use. If I've correctly divined what you're looking for, this should sidestep the issue entirely.</p> <p>Start by creating a new project from within RStudio. Once you've opened that project, you'll find that your working directory <code>getwd()</code> will be conveniently set where you have your project file at.</p> <p>If you're doing something larger, you can get yourself off on the right foot by using the "ProjectTemplate" package. On my system:</p> <pre><code># install.packages(c("ProjectTemplate")) library(ProjectTemplate) create.project("~/Desktop/MyProject") </code></pre> <p>This sets up a project skeleton, complete with unit test folder, doc folder, and everything else I might need for a "proper" R project.</p> <p>Next I create a project from RStudio as I mentioned above. Create it from an existing directory. The project will open, and all of your paths will be relative to the root of your 'MyProject' folder.</p> <p>I also like to initialize a git repository while I'm at it. From an OS X terminal window:</p> <pre><code>$ cd ~/Desktop/MyProject; git init </code></pre> <p>...and then add / commit the bare skeleton</p> <pre><code>$ git add * ; git commit -m "initial project skeleton" </code></pre> <p>From your RStudio session you can load things relative to your project root. Let's say you had iris.csv in your data subfolder:</p> <pre><code>read.csv("./data/iris.csv", header=TRUE) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload