about lm
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 advance
Your 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