[R] R is not reading(?) my data properly

From: Alexander Ovodenko <alexander.ovodenko_at_gmail.com>
Date: Sat, 9 Feb 2008 11:22:44 -0500

 Thanks for the replies to my prior question. My problem is that R always says object not found when I enter a variable name into a command. I converted a Stata file into an Rdata file by first loading the foreign package by entering


Then I asked R to read the Stata file by entering

pol572a1<- read.dta("C:\\alex\\Graduate Coursework\\Pol 572\\pol572a1.dta")

So now I can do a few things with the data, but I am only able to do so by entering


before typing another command. So I enter the following for a scatter plot: with(pol572a1, plot(rgnpc, incmean))

When I run a simple linear regression, I enter the following: with(pol572a1, lm(incmean~rgnpc))

But when try to get a fitted line, I enter the following: with(pol572a1, lm( share.gnp)<-lm(incmean~rgnpc)) But I get the following error message: Error in lm(share.gnp) <- lm(incmean ~ rgnpc) : object "share.gnp" not found

So what should I do to get R to read the dataframe in the ordinary way with the usual command? I am willing to scrap this dataframe and use the original Stata file to start over, as long as that resolves the problem.



        [[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. Received on Sat 09 Feb 2008 - 16:29:11 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 09 Feb 2008 - 17:30:12 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive