0

i am doing some regression models in grad school. I recently stumbled over R. I have my .csv file in R and the regression works out fine. But I don't know how to extract the variables in the data frame so that I can use

summary(visits)

I get the error

Error in summary(visits) : object 'visits' not found

I appreciate every answer. Thanks

Edit 9/5: My code looks something like this:

pool <- read.csv("Econ205A_Assigment_4_9.csv",sep=";", dec=",")
poolreg <- lm(visits ~ fee + pop + income, data = pool)
summary(visits)

The data frame looks like this

city visits fee income pop 1 1 168590 0.00 20600 36879 2 2 179599 0.00 33400 64520

My problem is that R doesn't treat any of the different observations as variables. So I get the error shown above.

Philip Schnaars
  • 3
  • 1
  • 1
  • 3
  • 2
    Welcome to SO. Please provide a reproducible example for this example, as described here: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example Otherwise this question is essentially impossible to answer. – Drew Steen Sep 03 '13 at 23:55
  • Sorry about that. I hope me edit made things more clear. – Philip Schnaars Sep 05 '13 at 17:02

1 Answers1

1

To get a summary of variables in database use,

mydata<-read.csv("yournameofcsvfile.csv") # reading the csv file assuming the csv file is in your working directory

summary(mydata$visits) # assuming visits is a variable

Or:

 summary(mydata["visits"])
Metrics
  • 15,172
  • 7
  • 54
  • 83