Hi all, I'm new to R and I'm trying to learn it to use with my undergraduate econometrics courses. I'm trying to work through Justin Shea's examples for Wooldridge's book, and I've hit a snag. This has to be easy, but I can't figure it out.

Using this code:

library(wooldridge)

data("hprice1")

simple_price_model<-lm(lprice~bdrms, data=hprice1)

summary(simple_price_model)

mean(lprice)

mean(lprice, data=hprice1)

I've entered two mean functions here to show what I've tried...both give the same erro.

I get results from the regression, but when I try to find the mean, or use lprice in other functions, I get an "object 'lprice' not found" error.

Obviously lprice is there as it worked in the linear model, so, there's clearly something I'm missing, but I can't find it.

Any help is appreciated...thanks.