Search code examples
rexcellibreoffice-calc

Why R doesn't let me change my working directory?


I'm working on Slackware and I'm trying to change my working directory in order to import a xlsx.

setwd("</home/diego/Downloads>")
Error in setwd("</home/diego/Downloads>") : 
cannot change working directory

Solution

  • This happens when directory path is wrong. Two steps may solve this:

    • First, check what's your current working directory in terminal or use getwd() with R
    • Second, setwd("path") according to your current working directory, for example, setwd("diego/downloads"), setwd("../../abc/def"), certainly you should drop the < and >