[R] Newbie question about by()

david.beede@mail.doc.gov david.beede at mail.doc.gov
Fri Mar 16 23:10:07 CET 2001


Dear R list:

I want to make separate estimates for each level of the variable "group."
After consulting many sources I am stumped as to why the following does not work:

> wintemp <- subset(alltemp, winner==1)
> my.ppr <- function(x)
+   {
+    if(nrow(x) >= 50) {
+    pprfile <- ppr(award~ilogemp, data=x,nterms=5,max.terms=10,optlevel=3)
+     summary(pprfile)
+      }
+    }
> test.by <- by(wintemp,as.factor(wintemp$group),my.ppr)
Error in model.frame.default(formula = award ~ ilogemp, data = x) :
     Object "x" not found

Any help would be greatly appreciated.
(I am sure I am misunderstanding some fundamental R concepts.)

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list