adilshah at stat.qau.edu.pk
2007-Nov-01 07:40 UTC
[R] Some problem in opening connection with" .dat" extention file in matrix(scan) function of R 2.5
Dear helpers please provide me some helpful answer to my problem while I m trying to run a program .I m attaching both the program and the data to which I have to obtain my estimation results. "Motives.dat" is the data file, and "OBTfile4.3" is the complete code of program. by Running this // rawdata<-matrix(scan(inputFile, n = nsubj*ncomp), nsubj, ncomp, byrow = TRUE) \\ The error appears to be // Error in file(file, "r") : unable to open connection In addition: Warning message: cannot open file 'motives_pc.dat', reason 'No such file or directory' in: file(file, "r") \\ where # name of preferences data file is assigned as, inputFile <- "motives_pc.dat Thanking Regards SYED ADIL HUSSAIN (+923455205402) QUAID-E-AZAM UNIVERSITY ISLAMABAD, PAKISTAN. This is Virus Free Email Scanned by QAU's McAfee Virus Scanner ""THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers." www.qau.edu.pk -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: motives_pc.dat Url: https://stat.ethz.ch/pipermail/r-help/attachments/20071101/2159daa3/attachment.pl -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: OBTfile4.3.txt Url: https://stat.ethz.ch/pipermail/r-help/attachments/20071101/2159daa3/attachment.txt
jim holtman
2007-Nov-01 12:20 UTC
[R] Some problem in opening connection with" .dat" extention file in matrix(scan) function of R 2.5
I would assume that the file that you are trying to read is not in the current directory your program is in. Do 'list.files()' to see what is in the current directory. Also use 'setwd' to get you to the directory you should be in. On 11/1/07, adilshah at stat.qau.edu.pk <adilshah at stat.qau.edu.pk> wrote:> Dear helpers please provide me some helpful answer to my problem while I m > trying to run a program .I m attaching both the program and the data to > which I have to obtain my estimation results. > "Motives.dat" is the data file, and "OBTfile4.3" is the complete code of > program. by Running this > // > rawdata<-matrix(scan(inputFile, n = nsubj*ncomp), nsubj, ncomp, byrow = TRUE) > \\ > The error appears to be > // > Error in file(file, "r") : unable to open connection > In addition: Warning message: > cannot open file 'motives_pc.dat', reason 'No such file or directory' in: > file(file, "r") > \\ > where # name of preferences data file is assigned as, > inputFile <- "motives_pc.dat > Thanking Regards > > SYED ADIL HUSSAIN (+923455205402) > QUAID-E-AZAM UNIVERSITY > ISLAMABAD, PAKISTAN. > > This is Virus Free Email Scanned by QAU's McAfee Virus Scanner > ""THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL > and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail > and its attachments from all computers." > www.qau.edu.pk > > ______________________________________________ > 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. > > >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve?
Julian Burgos
2007-Nov-01 20:19 UTC
[R] Some problem in opening connection with" .dat" extention file in matrix(scan) function of R 2.5
The error message is telling you that R cannot find your file. Is your 'motives_pc.dat' file in your R working directory? If not, you have to give a complete path to the scan() function. Julian adilshah at stat.qau.edu.pk wrote:> Dear helpers please provide me some helpful answer to my problem while I m > trying to run a program .I m attaching both the program and the data to > which I have to obtain my estimation results. > "Motives.dat" is the data file, and "OBTfile4.3" is the complete code of > program. by Running this > // > rawdata<-matrix(scan(inputFile, n = nsubj*ncomp), nsubj, ncomp, byrow = TRUE) > \\ > The error appears to be > // > Error in file(file, "r") : unable to open connection > In addition: Warning message: > cannot open file 'motives_pc.dat', reason 'No such file or directory' in: > file(file, "r") > \\ > where # name of preferences data file is assigned as, > inputFile <- "motives_pc.dat > Thanking Regards > > SYED ADIL HUSSAIN (+923455205402) > QUAID-E-AZAM UNIVERSITY > ISLAMABAD, PAKISTAN. > > This is Virus Free Email Scanned by QAU's McAfee Virus Scanner > ""THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL > and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail > and its attachments from all computers." > www.qau.edu.pk > > > ------------------------------------------------------------------------ > > ______________________________________________ > 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.