I was wondering why it won't let me change my working directory.
I keep seeing this error:
Error in setwd(dataDir) : cannot change working directory
This is my code:
dataDir <- "C:/Documents and Settings/My Documents/R/"
setwd(dataDir)
Seems to be an annoying Windows permissions issue; that's a legacy directory. There are 2.93 million Google hits along the lines of "Windows (7/)10: Access to the path 'C:\Documents and Settings' is denied". Look for advice in Windows forums, and check what the ownership and permissions on "C:/Documents and Settings/My Documents/..." are currently, and what they're supposed to be, and whether Administrator account is enabled. (Frankly not the best choice for the R install packages directory, but many installers use it, or default to it.)
setwd()
works fine for a more harmless choice of directory, e.g. 'C:\Users\your_name\R'