Hi, I need to write program to run some results from an experiment. i have the results saved in 2 different files, named "tuesday" and "wednesday" (both located within the same file). when i wrote the program for "tuesday" i had no problem running it, but when i changed the work directory to wednesday i got the "cannot change working directory" message. I don't understand what's different between the two. my first code was: setwd("/Users/user/Desktop/Recorded\ results/tuesday") and my second code is: setwd("/Users/user/Desktop/Recorded\ results/wednesday") and i copied the exact location from the terminal, so i can't have typos (i am using a mac, if that makes any difference). any suggestions? i will be grateful for any insight. thanks mela -- View this message in context: http://r.789695.n4.nabble.com/cannot-change-working-directory-tp4492812p4492812.html Sent from the R help mailing list archive at Nabble.com.
Hi, I need to write program to run some results from an experiment. i have the results saved in 2 different files, named "tuesday" and "wednesday" (both located within the same file). when i wrote the program for "tuesday" i had no problem running it, but when i changed the work directory to wednesday i got the "cannot change working directory" message. I don't understand what's different between the two. my first code was: setwd("/Users/user/Desktop/Recorded\ results/tuesday") and my second code is: setwd("/Users/user/Desktop/Recorded\ results/wednesday") and i copied the exact location from the terminal, so i can't have typos (i am using a mac, if that makes any difference). any suggestions? i will be grateful for any insight. thanks mela -- View this message in context: http://r.789695.n4.nabble.com/cannot-change-working-directory-tp4492866p4492866.html Sent from the R help mailing list archive at Nabble.com.
If you are on a mac, you don't need to escape spaces within setwd(): e.g., on my machine, setwd("~/Desktop/Current Semester") works just fine. Michael On Wed, Mar 21, 2012 at 12:08 PM, mela <dashmisafta at gmail.com> wrote:> Hi, > > I need to write ?program to run some results from an experiment. i have the > results saved in 2 different files, named "tuesday" and "wednesday" (both > located within the same file). when i wrote the program for "tuesday" i had > no problem running it, but when i changed the work directory to wednesday i > got the "cannot change working directory" message. I don't understand what's > different between the two. > > my first code was: > > setwd("/Users/user/Desktop/Recorded\ results/tuesday") > > and my second code is: > > setwd("/Users/user/Desktop/Recorded\ results/wednesday") > > and i copied the exact location from the terminal, so i can't have typos (i > am using a mac, if that makes any difference). > > any suggestions? i will be grateful for any insight. > > thanks > > mela > > > -- > View this message in context: http://r.789695.n4.nabble.com/cannot-change-working-directory-tp4492812p4492812.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > 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.
list.dirs() will list the directories in that file exactly as R sees them. If you are getting can't change working directory messages I can only think of two reasons: i) File permissions (though that's unlikely to get messed up unless there's someone around who knows how to do that in the first place) ii) You don't actually have the right wd name. So like I said, please give the output of list.dirs("/Users/user/Desktop/Recorded results/", recursive = FALSE) and then try something like setwd(list.dirs("/Users/user/Desktop/Recorded results/", recursive FALSE)[XXX]) where XXX is the number of the path that gives the Wednesday files. normalizePath() might also help. If you really want to check the file permissions route, this will be a start system("ls -hFGlxo /Users/user/Desktop/Recorded results") but you'll probably need some help to interpret the output. Michael On Wed, Mar 21, 2012 at 12:30 PM, Carmela Friedman <dashmisafta at gmail.com> wrote:> could you explain what that is please? i am new to R > On 21 Mar 2012, at 16:27, R. Michael Weylandt wrote: > >> Scratch that -- while true, it doesn't seem to cause that error message. >> >> Can you do this? >> >> list.dirs("/Users/user/Desktop/Recorded results/") >> >> Also, are you sure you have various access permissions to the Wednesday folder? >> >> Michael >> >> On Wed, Mar 21, 2012 at 12:25 PM, R. Michael Weylandt >> <michael.weylandt at gmail.com> wrote: >>> If you are on a mac, you don't need to escape spaces within setwd(): >>> e.g., on my machine, ?setwd("~/Desktop/Current Semester") works just >>> fine. >>> >>> Michael >>> >>> On Wed, Mar 21, 2012 at 12:08 PM, mela <dashmisafta at gmail.com> wrote: >>>> Hi, >>>> >>>> I need to write ?program to run some results from an experiment. i have the >>>> results saved in 2 different files, named "tuesday" and "wednesday" (both >>>> located within the same file). when i wrote the program for "tuesday" i had >>>> no problem running it, but when i changed the work directory to wednesday i >>>> got the "cannot change working directory" message. I don't understand what's >>>> different between the two. >>>> >>>> my first code was: >>>> >>>> setwd("/Users/user/Desktop/Recorded\ results/tuesday") >>>> >>>> and my second code is: >>>> >>>> setwd("/Users/user/Desktop/Recorded\ results/wednesday") >>>> >>>> and i copied the exact location from the terminal, so i can't have typos (i >>>> am using a mac, if that makes any difference). >>>> >>>> any suggestions? i will be grateful for any insight. >>>> >>>> thanks >>>> >>>> mela >>>> >>>> >>>> -- >>>> View this message in context: http://r.789695.n4.nabble.com/cannot-change-working-directory-tp4492812p4492812.html >>>> Sent from the R help mailing list archive at Nabble.com. >>>> >>>> ______________________________________________ >>>> R-help at r-project.org mailing list >>>> 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. >