Hi, I am trying to read a text file located in following paths. I am getting error if I try to read from long directory.. But if I place the file right under C, It runs fine. Could anyone tell me how to read table from following directory path ? data1 <-read.table("C:\\Documents and Settings Administrator\\My Documents\\My Dropbox\\data.txt", sep="\t", header=TRUE) Error in file(file, "rt") : cannot open the connection In addition: Warning message: In file(file, "rt") : cannot open file 'C:\Documents and Settings Administrator\My Documents\My Dropbox\data.txt': No such file or directory> data1 <-read.table("C:\\data.txt",sep="\t",header=TRUE) >-- View this message in context: http://r.789695.n4.nabble.com/space-in-directory-name-tp3810448p3810448.html Sent from the R help mailing list archive at Nabble.com.
You are missing \\ between Documents and settings and Administrator. ----- Original Message ----- From: dbonneau <daronnebonneau at gmail.com> To: r-help at r-project.org Cc: Sent: Tuesday, September 13, 2011 10:59 AM Subject: [R] space in directory name Hi, I am trying to read a text file located in following paths. I am getting error if I try to read from long directory..? But if I place the file right under C, It runs fine. Could anyone tell me how to read table from following directory path ? data1 <-read.table("C:\\Documents and Settings Administrator\\My Documents\\My Dropbox\\data.txt", sep="\t", header=TRUE) Error in file(file, "rt") : cannot open the connection In addition: Warning message: In file(file, "rt") : ? cannot open file 'C:\Documents and Settings Administrator\My Documents\My Dropbox\data.txt': No such file or directory> data1 <-read.table("C:\\data.txt",sep="\t",header=TRUE) >-- View this message in context: http://r.789695.n4.nabble.com/space-in-directory-name-tp3810448p3810448.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.
I suggest changing Documents and Settings Administrator to Documents and Settings\\Administrator ... JC 2011/9/13 dbonneau <daronnebonneau at gmail.com>:> Hi, I am trying to read a text file located in following paths. I am getting > error if I try to read from long directory.. ?But if I place the file right > under C, It runs fine. Could anyone tell me how to read table from following > directory path ? > > data1 <-read.table("C:\\Documents and Settings Administrator\\My > Documents\\My Dropbox\\data.txt", sep="\t", header=TRUE) > Error in file(file, "rt") : cannot open the connection > In addition: Warning message: > In file(file, "rt") : > ?cannot open file 'C:\Documents and Settings Administrator\My Documents\My > Dropbox\data.txt': No such file or directory >> data1 <-read.table("C:\\data.txt",sep="\t",header=TRUE) >> > > -- > View this message in context: http://r.789695.n4.nabble.com/space-in-directory-name-tp3810448p3810448.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. >