> -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of x > Sent: Wednesday, April 15, 2009 1:54 PM > To: r-help@r-project.org > Subject: [R] problem with read.table > > > Hi all, > > I've simple code to read a file (verify.txt in the same directory as the > script file) but > when I run this I get > "Error in eval(expr, envir, enclos) : object "y" not found". > > data_model.df = read.table("./verify.txt", header=TRUE, nrows=10); > f <- lm(y ~ x) > > Could someone pls tell me what's wrong with this code? > > Sincere thanks!
I don't think there is a problem with read.table(). You need to attach the dataframe or specify data=data_model.df in the call to lm() f <- lm(y ~ x, data = data_model.df) Hope this is helpful, Dan Daniel J. Nordlund Washington State Department of Social and Health Services Planning, Performance, and Accountability Research and Data Analysis Division Olympia, WA 98504-5204 ______________________________________________ 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.