title: Trouble with setwd() in R
body: <p>My apologies if this has been answered already, I've looked through many very similar threads but haven't found a solution. I'm new to R, just started a few days ago but I feel like I'm making decent progress. I'm attempting to load in some old data from my undergrad thesis to mess around with a bit, but can't seem to get my working directory to change. </p>
  
  <p>So far, I've created a path:</p>
  
  <pre><code>path&lt;- file.path("C:", "Users", "Daniel", "Desktop",
                   "R_Practice", "Thesisdata.csv")
  </code></pre>
  
  <p>and I had success with reading the file designated by the path with</p>
  
  <pre><code>read.csv(path, stringsAsFactors = TRUE)
  </code></pre>
  
  <p>However, when I try to use </p>
  
  <pre><code>setwd(path)
  </code></pre>
  
  <p>or </p>
  
  <pre><code>setwd("C:", "Users", "Daniel", "Desktop",
        "R_Practice", "Thesisdata.csv")
  </code></pre>
  
  <p>I get an error message reading </p>
  
  <blockquote>
    <p>Error in setwd(x) : cannot change working directory."</p>
  </blockquote>
  
  <p>Can anybody explain to me what I'm doing wrong or point me in the right direction? I don't really understand why it would be able to successfully read the file using the path but can't set it to the working directory.</p>