I have a script that runs correctly (no errors) on Windows, the first command is a "setwd(.....windows directory)"I installed the script on a Linux machine and changed the windows directory reference to the correct directory on the linux machine.when I ran the script I got a message that "cannot change working directory".?I confirmed I have read and write access to the directory.I mainly run R on windows infrequently use linux/unix and would appreciate suggestions.thanks in advance?Chris Barker, Ph.D. Adjunct Associate Professor of Biostatistics - UIC-SPH [[alternative HTML version deleted]]
I have a script that runs correctly (no errors) on Windows, the first command is a "setwd(.....windows directory)"I installed the script on a Linux machine and changed the windows directory reference to the correct directory on the linux machine.when I ran the script I got a message that "cannot change working directory".?I confirmed I have read and write access to the directory.I mainly run R on windows infrequently use linux/unix and would appreciate suggestions.thanks in advance?Chris Barker, Ph.D. Adjunct Associate Professor of Biostatistics - UIC-SPH [[alternative HTML version deleted]]
Try 'choose.dir()' to see if you can navigate to the given directory, or take baby steps by doing one directory at a time. Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Mon, Jul 27, 2015 at 3:38 PM, Chris <chris.barker at barkerstats.com> wrote:> > I have a script that runs correctly (no errors) on Windows, the first > command is a "setwd(.....windows directory)"I installed the script on a > Linux machine and changed the windows directory reference to the correct > directory on the linux machine.when I ran the script I got a message that > "cannot change working directory". I confirmed I have read and write access > to the directory.I mainly run R on windows infrequently use linux/unix and > would appreciate suggestions.thanks in advance Chris Barker, Ph.D. > Adjunct Associate Professor of Biostatistics - UIC-SPH > > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.[[alternative HTML version deleted]]
On Mon, Jul 27, 2015 at 2:38 PM, Chris <chris.barker at barkerstats.com> wrote:> > I have a script that runs correctly (no errors) on Windows, the first > command is a "setwd(.....windows directory)"I installed the script on a > Linux machine and changed the windows directory reference to the correct > directory on the linux machine.when I ran the script I got a message that > "cannot change working directory". I confirmed I have read and write access > to the directory.I mainly run R on windows infrequently use linux/unix and > would appreciate suggestions.thanks in advance Chris Barker, Ph.D. > Adjunct Associate Professor of Biostatistics - UIC-SPH > >?I took a quick look at the source where I _think_ the message is coming from: src/main/util.c . That message comes out when the chdir() function (C library routine) returns any kind of error.? Because you said that have read & write access (you should also have execute in most cases), then the only return which makes sense is ENAMETOOLONG (although it could also be ENOMEM). How long is the path name? The usual limit is 255 bytes. -- Schrodinger's backup: The condition of any backup is unknown until a restore is attempted. Yoda of Borg, we are. Futile, resistance is, yes. Assimilated, you will be. He's about as useful as a wax frying pan. 10 to the 12th power microphones = 1 Megaphone Maranatha! <>< John McKown [[alternative HTML version deleted]]
You can get a more informative error message from system("bash -c 'cd yourDirectory'"), although it will not take R to that directory if there are no problems. E.g., I did in a shell % mkdir -p dir/subdir % chmod -x dir to make an untraversable directory 'dir' and a subdirectory of it. Then in R I get: > setwd("dir/subdir") Error in setwd("dir/subdir") : cannot change working directory > system("bash -c 'cd dir/subdir'") bash: line 0: cd: dir/subdir: Permission denied And for a nonexistent directory I get: > setwd("no/such/directory") Error in setwd("no/such/directory") : cannot change working directory > system("bash -c 'cd no/such/directory'") bash: line 0: cd: no/such/directory: No such file or directory (It would be nice if the name of the offending directory and a reason were given in setwd's error message, but that would require someone to write the code.) Bill Dunlap TIBCO Software wdunlap tibco.com On Mon, Jul 27, 2015 at 12:38 PM, Chris <chris.barker at barkerstats.com> wrote:> > I have a script that runs correctly (no errors) on Windows, the first > command is a "setwd(.....windows directory)"I installed the script on a > Linux machine and changed the windows directory reference to the correct > directory on the linux machine.when I ran the script I got a message that > "cannot change working directory". I confirmed I have read and write access > to the directory.I mainly run R on windows infrequently use linux/unix and > would appreciate suggestions.thanks in advance Chris Barker, Ph.D. > Adjunct Associate Professor of Biostatistics - UIC-SPH > > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.[[alternative HTML version deleted]]