[R] Working directory

Marc Schwartz (via MN) mschwartz at mn.rr.com
Thu Apr 13 22:36:19 CEST 2006

On Thu, 2006-04-13 at 16:28 -0400, Gong, Yanyan wrote:
> Hi,
> I am a new user of "R", I am trying to read my data in.. "Cervixhc.dat" used
> to be in a different directory, now it has been moved to "O:\E&s\APC cervix
> FINAL (YG,MC,MD)\Manuscript\Data", but when I ran the following program (in
> red) I got an error message "Error in setwd(dir) : cannot change working
> directory", and "Error in file(file, "r", encoding = encoding) : 
>         unable to open connection
> In addition: Warning message:
> cannot open file 'O:E&sAPC cervix FINAL (YG,MC,MD)ManuscriptPrograms
> t.R', reason 'Invalid argument' "
> Here is my program:
> setwd("O:\E&s\APC cervix FINAL (YG,MC,MD)\Manuscript\Data")
> library(Epi)
> source("O:\E&s\APC cervix FINAL (YG,MC,MD)\Manuscript\Programs\tt.R")
> cervix_all<-read.table("cervixhc.dat",header=T)
> Wonder whether you can help me to solve the problem? Thanks very much!
> Sincerely,
> Yanyan

See R for Windows FAQ 2.16 "R can't find my file, but I know it is



Marc Schwartz

More information about the R-help mailing list