In the past I've only used R, but I want to use RStudio to teach an intro stats course. However, I'm having trouble getting certain basic commands to work properly in RStudio, even though they work fine in R. For example, I have a folder on my desktop named "Folder."
In R, I can easily set this as the working directory:
getwd()
[1] "/Users/username"
setwd("Desktop")
getwd()
[1] "/Users/username/Desktop"
setwd("Folder")
getwd()
[1] "/Users/username/Desktop/Folder"
However, in RStudio, if I try to set a desktop folder as the working directory, it just reverts to my username folder:
setwd("/Users/username/Desktop")
getwd()
[1] "/Users/username/Desktop"
setwd("Folder")
getwd()
[1] "/Users/username"
I can create a new folder in my username folder as the directory, along with any folder within that new folder. But any time I use the desktop (or any other pre-existing folder in my username folder, like "Downloads" or "Documents") within the middle of a working directory path, RStudio reverts to the username folder.
Any idea what is going on here? I'm using MacOS and I've reinstalled both R and RStudio.