Dear friends, I have a csv file entitled ven.csv located in C:\\, this file contains only two columns:"ve" and "su" I have written the following lines: data=read.csv("c:\\ven.csv",header=TRUE,sep=";"); lm(ve~ su) I have obtained the following message: Error in eval(expr, envir, enclos) : object 've' does not exist. What's the problem? thank you for your help in advance [[alternative HTML version deleted]]
Hello, 1. Don't call your dataset 'data', it's the name of an R function. 2. Imagine it's called 'dat'. Then you must use the lm() argument data = dat. Like this: lm(ve~ su, data = dat) Hope this helps, Rui Barradas Em 16-11-2012 19:42, Sonia Amin escreveu:> Dear friends, > I have a csv file entitled ven.csv located in C:\\, this file contains only > two columns:"ve" and "su" I have written the following lines: > data=read.csv("c:\\ven.csv",header=TRUE,sep=";"); > > lm(ve~ su) > I have obtained the following message: > > Error in eval(expr, envir, enclos) : object 've' does not exist. What's the > problem? thank you for your help in advance > > [[alternative HTML version deleted]] > > ______________________________________________ > 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 quote Rolf Turner: "Learn something about R; don't just hammer and hope. Read the introductory manuals and scan the FAQ." The answer is that your data are in "data," but until you make a greater effort to learn R, I'm not sure this will be helpful to you. Cheers, Bert On Fri, Nov 16, 2012 at 11:42 AM, Sonia Amin <soniaamin5 at gmail.com> wrote:> Dear friends, > I have a csv file entitled ven.csv located in C:\\, this file contains only > two columns:"ve" and "su" I have written the following lines: > data=read.csv("c:\\ven.csv",header=TRUE,sep=";"); > > lm(ve~ su) > I have obtained the following message: > > Error in eval(expr, envir, enclos) : object 've' does not exist. What's the > problem? thank you for your help in advance > > [[alternative HTML version deleted]] > > ______________________________________________ > 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.-- Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
On 16-11-2012, at 20:42, Sonia Amin wrote:> Dear friends, > I have a csv file entitled ven.csv located in C:\\, this file contains only > two columns:"ve" and "su" I have written the following lines: > data=read.csv("c:\\ven.csv",header=TRUE,sep=";"); > > lm(ve~ su) > I have obtained the following message: > > Error in eval(expr, envir, enclos) : object 've' does not exist. What's the > problem? thank you for your help in advanceYour ve and su are in the dataframe "data". (Don't use data as name for R objects; it is a builtin function). They are not in the environment from which lm is called (in this case probably the global environment). You haven't specified that ve and su are in dataframe "data". So ?lm and look at the description of the "data" argument in the section "Arguments". lm(ve~su, data=data) should work. Berend
Rui and Berend thank you for your help before posting this mail, I change the name of my data and it becomes "mat" and I tried with this line: lm (ve~ su, data = mat) I got this message: Lm.fit error in (x, y, offset = offset = singular.ok singular.ok ...) [[alternative HTML version deleted]]
Hello, The error message is not at all clear. Have you copied and pasted it? Can you post a data example? Using ?dput, for instance. dput(head(mat, 30)) # paste the output of this in a post Rui Barradas Em 16-11-2012 21:44, Sonia Amin escreveu:> Rui and Berend thank you for your help > before posting this mail, I change the name of my data and it becomes "mat" and > I tried with this line: > lm (ve~ su, data = mat) > I got this message: > Lm.fit error in (x, y, offset = offset = singular.ok singular.ok ...) > > [[alternative HTML version deleted]] > > ______________________________________________ > 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.
ok I am sorry 2012/11/16 Hasan Diwan <hasan.diwan@gmail.com>> Ms Amin, > > On 16 November 2012 14:06, Sonia Amin <soniaamin5@gmail.com> wrote: > >> I have attached the file ven.csv > > > Attachments don't come through on the mailing list. Please enclose the > first few lines in your message. -- H > -- > Sent from my mobile device > Envoyait de mon portable >[[alternative HTML version deleted]]
dat=read.csv("c:\\ven.csv",header=TRUE,sep=";"); attach(attach(dat)) dat lm.1<-lm(ve~ su) summary(lm.1) GL Frank> Date: Fri, 16 Nov 2012 20:42:39 +0100 > From: soniaamin5@gmail.com > To: r-help@r-project.org > Subject: [R] about lm > > Dear friends, > I have a csv file entitled ven.csv located in C:\\, this file contains only > two columns:"ve" and "su" I have written the following lines: > data=read.csv("c:\\ven.csv",header=TRUE,sep=";"); > > lm(ve~ su) > I have obtained the following message: > > Error in eval(expr, envir, enclos) : object 've' does not exist. What's the > problem? thank you for your help in advance > > [[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 > and provide commented, minimal, self-contained, reproducible code.[[alternative HTML version deleted]]
On Sat, Nov 17, 2012 at 12:29 PM, FJ M <chicagobrownblue at hotmail.com> wrote:> > dat=read.csv("c:\\ven.csv",header=TRUE,sep=";"); > attach(attach(dat))Ahh! Two at once! Why -- for the love of god, why! :-P M
On Nov 17, 2012, at 4:29 AM, FJ M wrote:> > dat=read.csv("c:\\ven.csv",header=TRUE,sep=";"); > attach(attach(dat))It is generally less error prone to avoid attach (even once).> dat > lm.1<-lm(ve~ su)And instead use: lm.1<-lm(ve~ su, data=dat)> summary(lm.1) > > GL Frank >> Date: Fri, 16 Nov 2012 20:42:39 +0100 >> From: soniaamin5 at gmail.com >> To: r-help at r-project.org >> Subject: [R] about lm >> >> Dear friends, >> I have a csv file entitled ven.csv located in C:\\, this file >> contains only >> two columns:"ve" and "su" I have written the following lines: >> data=read.csv("c:\\ven.csv",header=TRUE,sep=";"); >> >> lm(ve~ su) >> I have obtained the following message: >> >> Error in eval(expr, envir, enclos) : object 've' does not exist. >> What's the >> problem? thank you for your help in advance >> >> [[alternative HTML version deleted]] >>When you do get around to reading the Posting Guide, please note the section where the request to NOT post in HTML is made.> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.-- David Winsemius, MD Alameda, CA, USA
Hi Values ve or su came as factors during the input. Probably some mismatch in decimal point, nonumeric value somewhere, thousands separator or something else. At least str(mat) can help you (and us) what is the problem. Regards Petr> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r- > project.org] On Behalf Of Sonia Amin > Sent: Friday, November 16, 2012 10:44 PM > To: r-help at r-project.org > Subject: [R] about lm > > Rui and Berend thank you for your help > before posting this mail, I change the name of my data and it becomes > "mat" and I tried with this line: > lm (ve~ su, data = mat) > I got this message: > Lm.fit error in (x, y, offset = offset = singular.ok singular.ok ...) > > [[alternative HTML version deleted]] > > ______________________________________________ > 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.