Nikita Dinger
2015-Aug-15 17:06 UTC
[R] Error -> cannot open file 'specdata/001.csv': No such file or directory; Windows 8, R Version 3.2.1
I am having a problem in opening the excel files in specdata folder. I have completed coding the R program for the assignment but when I run the following commands in the R console, *source("pollutantmean.R")* *> pollutantmean("specdata", "nitrate", 23)* I get an error message stating *Error in file(file, "rt") : cannot open the connection* *In addition: Warning message:* *In file(file, "rt") :* * cannot open file 'specdata/023.csv': No such file or directory* I tried everything and reset my Working Directory to *C:/Users/acer/My Documents/specdata/rprog-data-specdata/specdata* After the last specdata folder are all the excel sheets numbered 001 to 332. I searched the internet and all other options available, and got a solution to open it using the following command: *df <- read.csv("specdata/001.csv")* This generated the following error message *Error in file(file, "rt") : cannot open the connection* *In addition: Warning message:* *In file(file, "rt") :* * cannot open file 'specdata/001.csv': No such file or directory* I have tried various other commands also such as *path <- c(paste("./",directory, "/",formatC(id[i], width=3, flag=0),".csv",sep=""))* However, all the commands show some error. What shall I do? I am using the 3.2.1 version of R on a Windows 8 laptop. Regards, Nikita Dinger [[alternative HTML version deleted]]
David Winsemius
2015-Aug-15 19:03 UTC
[R] Error -> cannot open file 'specdata/001.csv': No such file or directory; Windows 8, R Version 3.2.1
This is pretty obviously difficulty in completing an assignment for a Coursera task. You are asked by the Course Director of the entry-level R course to post your questions to a website established for the purpose of requesting assistance. Rhelp is a text-only mailing list (although you might have been duped into thinking that it was a website by the Nabble mirror.) Rhelp has a "no homework" policy. -- David. On Aug 15, 2015, at 10:06 AM, Nikita Dinger wrote:> I am having a problem in opening the excel files in specdata folder. > > I have completed coding the R program for the assignment but when I run the > following commands in the R console, > > *source("pollutantmean.R")* > *> pollutantmean("specdata", "nitrate", 23)* > > I get an error message stating > > *Error in file(file, "rt") : cannot open the connection* > *In addition: Warning message:* > *In file(file, "rt") :* > * cannot open file 'specdata/023.csv': No such file or directory* > > I tried everything and reset my Working Directory to > > > *C:/Users/acer/My Documents/specdata/rprog-data-specdata/specdata* > > After the last specdata folder are all the excel sheets numbered 001 to 332. > > I searched the internet and all other options available, and got a solution > to open it using the following command: > > *df <- read.csv("specdata/001.csv")* > > > This generated the following error message > > *Error in file(file, "rt") : cannot open the connection* > *In addition: Warning message:* > *In file(file, "rt") :* > * cannot open file 'specdata/001.csv': No such file or directory* > > I have tried various other commands also such as > > > *path <- c(paste("./",directory, "/",formatC(id[i], width=3, > flag=0),".csv",sep=""))* > > However, all the commands show some error. > > What shall I do? > I am using the 3.2.1 version of R on a Windows 8 laptop. > > Regards, > Nikita Dinger > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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.David Winsemius Alameda, CA, USA
Anthoni, Peter (IMK)
2015-Aug-17 05:44 UTC
[R] Error -> cannot open file 'specdata/001.csv': No such file or directory; Windows 8, R Version 3.2.1
Hi Nikita, To check whether the files are really there, run the following at the R prompt: getwd() list.files()> *C:/Users/acer/My Documents/specdata/rprog-data-specdata/specdata*Your working path looks like you either need to set it to: C:/Users/acer/My Documents/specdata/rprog-data-specdata or change your read.csv to: df <- read.csv("001.csv") cheers Peter> On 15 Aug 2015, at 19:06, Nikita Dinger <dingernikita at gmail.com> wrote: > > I am having a problem in opening the excel files in specdata folder. > > I have completed coding the R program for the assignment but when I run the > following commands in the R console, > > *source("pollutantmean.R")* > *> pollutantmean("specdata", "nitrate", 23)* > > I get an error message stating > > *Error in file(file, "rt") : cannot open the connection* > *In addition: Warning message:* > *In file(file, "rt") :* > * cannot open file 'specdata/023.csv': No such file or directory* > > I tried everything and reset my Working Directory to > > > *C:/Users/acer/My Documents/specdata/rprog-data-specdata/specdata* > > After the last specdata folder are all the excel sheets numbered 001 to 332. > > I searched the internet and all other options available, and got a solution > to open it using the following command: > > *df <- read.csv("specdata/001.csv")* > > > This generated the following error message > > *Error in file(file, "rt") : cannot open the connection* > *In addition: Warning message:* > *In file(file, "rt") :* > * cannot open file 'specdata/001.csv': No such file or directory* > > I have tried various other commands also such as > > > *path <- c(paste("./",directory, "/",formatC(id[i], width=3, > flag=0),".csv",sep=""))* > > However, all the commands show some error. > > What shall I do? > I am using the 3.2.1 version of R on a Windows 8 laptop. > > Regards, > Nikita Dinger > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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.