I haven't used R in a couple of years, and now am trying something as simple as importing a csv file and am running into problems right away. * mydata <- read.csv (Wordata1.csv, sep="") Error in read.table(file = file, header = header, sep = sep, quote = quote, : object 'Wordata1.csv' not found *I've tried in both as as read.csv and read.table and still get the same message. I've double-checked that I'm in the right directory using "getwd()" and indeed I am. Any ideas on what might be causing this error message? Can it be something in the format of the file? (I've looked through the archives and didn't see anything that might explain it) thank you!!! Alina [[alternative HTML version deleted]]
You probably left off the quotes for the file name mydata <- read.csv ("Wordata1.csv", sep="") it is looking for an R variable named Wordata1.csv which contains the name of the file. Since you are giving it the name of the file, it must be in a character-valued constant. On Mon, Jun 20, 2011 at 5:16 PM, Alina Sheyman <alinashe@gmail.com> wrote:> I haven't used R in a couple of years, and now am trying something as > simple as importing a csv file and am running into problems right away. > * > mydata <- read.csv (Wordata1.csv, sep="") > Error in read.table(file = file, header = header, sep = sep, quote = quote, > : > object 'Wordata1.csv' not found > > *I've tried in both as as read.csv and read.table and still get the same > message. > I've double-checked that I'm in the right directory using "getwd()" and > indeed I am. > > Any ideas on what might be causing this error message? Can it be something > in the format of the file? > (I've looked through the archives and didn't see anything that might > explain > it) > > thank you!!! > Alina > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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<http://www.r-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]
R is looking for an R object named Wordata1.csv that contains your file name. Instead you want: mydata <- read.csv ("Wordata1.csv", sep="") Sarah On Mon, Jun 20, 2011 at 5:16 PM, Alina Sheyman <alinashe at gmail.com> wrote:> I haven't used R in a couple of years, and now ?am trying something as > simple as importing a csv file and am running into problems right away. > * > mydata <- read.csv (Wordata1.csv, sep="") > Error in read.table(file = file, header = header, sep = sep, quote = quote, > : > ?object 'Wordata1.csv' not found > > *I've tried in both as as read.csv and read.table and still get the same > message. > I've double-checked that I'm in the right directory using "getwd()" and > indeed I am. > > Any ideas on what might be causing this error message? Can it be something > in the format of the file? > (I've looked through the archives and didn't see anything that might explain > it) > > thank ?you!!! > Alina-- Sarah Goslee http://www.functionaldiversity.org
On Jun 20, 2011, at 5:16 PM, Alina Sheyman wrote:> I haven't used R in a couple of years, and now am trying something as > simple as importing a csv file and am running into problems right > away. > * > mydata <- read.csv (Wordata1.csv, sep="") > Error in read.table(file = file, header = header, sep = sep, quote = > quote, > : > object not found > > *I've tried in both as as read.csv and read.table and still get the > same > message. > I've double-checked that I'm in the right directory using "getwd()" > and > indeed I am. > > Any ideas on what might be causing this error message? Can it be > something > in the format of the file?No. The error is telling you that there is no object with the name 'Wordata1.csv' in the R workspace. Try quoting the file name (assuming such a named file is in your working directory.) It also doesn't make much sense and may even be an error to supply a sep="" argument to read.csv().> (I've looked through the archives and didn't see anything that might > explain > it)Well, there are surely examples where questioners have been told they needed to quote the 'file' argument, but there might be many other errors that created an invalid argument. -- David Winsemius, MD West Hartford, CT