Hello, I am a new user of R, and I am not able to read/scan external files. I am working in a Linux environment. I have read through the R FAQ and documents and have not been successful using the recommendations. Below are several scripts I've used and the error messages. . I've cc'd Brandon Whitcher because it was recommended in another FAQ. I read that this is a bug that occurs on Windows. Is there is a patch/fix that I can use? I'd appreciate any help with this problem. Thnx, Barbara Chisolm Test2 <- scan("C:\\bac\\TestData2") Error in file(file, "r") : cannot open file `C:\bac\TestData2 '> test1<-read.table('J:/bac/R/TestDataWord.txt')Error in file(file, "r") : cannot open file `J:/bac/R/TestDataWord.txt'> setwd("J:/bac/R/")Error in setwd(dir) : cannot change working directory
Chisolm, Barbara wrote:> Hello, > > I am a new user of R, and I am not able to read/scan external files. I am > working in a Linux environment. I have read through the R FAQ and documents > and have not been successful using the recommendations. Below are several > scripts I've used and the error messages. . > > I've cc'd Brandon Whitcher because it was recommended in another FAQ. I > read that this is a bug that occurs on Windows. Is there is a patch/fix > that I can use? I'd appreciate any help with this problem. > > Thnx, > Barbara Chisolm > > Test2 <- scan("C:\\bac\\TestData2") > Error in file(file, "r") : cannot open file `C:\bac\TestData2You told us you are on Linux, but C:\bac\TestData2 does look like a Windows environment!>>test1<-read.table('J:/bac/R/TestDataWord.txt') > > Error in file(file, "r") : cannot open file `J:/bac/R/TestDataWord.txt'>> >>setwd("J:/bac/R/") > > Error in setwd(dir) : cannot change working directoryIf all these files / paths do exist: Which version of R / Windows are you using? Uwe Ligges
You say you are using the Linux environment. Hence you files are not being found. You are using the path system of a Windows environment. If your "bac" directory is in your home directory, try the following: Test2 <- scan("~/bac/TestData2") HTH, Partha. "Chisolm, Barbara" <barbara.chisolm@glenayre.com> Sent by: r-help-bounces@stat.math.ethz.ch 03/17/2003 11:52 AM To: "''r-help@stat.math.ethz.ch''" <r-help@stat.math.ethz.ch> cc: "''bjwhitcher@yahoo.co.uk''" <bjwhitcher@yahoo.co.uk> Subject: [R] Error in file(file, "r") Hello, I am a new user of R, and I am not able to read/scan external files. I am working in a Linux environment. I have read through the R FAQ and documents and have not been successful using the recommendations. Below are several scripts I''ve used and the error messages. . I''ve cc''d Brandon Whitcher because it was recommended in another FAQ. I read that this is a bug that occurs on Windows. Is there is a patch/fix that I can use? I''d appreciate any help with this problem. Thnx, Barbara Chisolm Test2 <- scan("C:\\bac\\TestData2") Error in file(file, "r") : cannot open file `C:\bac\TestData2 ''> test1<-read.table(''J:/bac/R/TestDataWord.txt'')Error in file(file, "r") : cannot open file `J:/bac/R/TestDataWord.txt''> setwd("J:/bac/R/")Error in setwd(dir) : cannot change working directory ______________________________________________ R-help@stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. [[alternate HTML version deleted]]
--- "Chisolm, Barbara" <barbara.chisolm at glenayre.com> wrote:> Hello, > > I am a new user of R, and I am not able to read/scan external files. I am > working in a Linux environment. I have read through the R FAQ and documents > and have not been successful using the recommendations. Below are several > scripts I've used and the error messages. . > > I've cc'd Brandon Whitcher because it was recommended in another FAQ. I > read that this is a bug that occurs on Windows. Is there is a patch/fix > that I can use? I'd appreciate any help with this problem. > > Thnx, > Barbara Chisolm > > Test2 <- scan("C:\\bac\\TestData2") > Error in file(file, "r") : cannot open file `C:\bac\TestData2 > > ' > > test1<-read.table('J:/bac/R/TestDataWord.txt') > Error in file(file, "r") : cannot open file `J:/bac/R/TestDataWord.txt' > > > setwd("J:/bac/R/") > Error in setwd(dir) : cannot change working directory >Um, I'm confused as to why I was cc'ed for this problem. I operate a couple of packages but am not involved in core R questions. Which FAQ was I referenced on? Brandon