On May 17, 2010, at 1:36 PM, GL wrote:
>
> I have the two loops listed below. The first executes perfectly and
> creates a
> series of density plots. The second does not produce any output,
> however, if
> I enter the exact bwplot command after the loop executes, I get
> output for
> the last value in the list of services. Why am I not getting output
> for
> bwplot inside the loop?
>
> #INSIDE LOOP PERFECT OUTPUT - ONE FOR EACH SERVICE
> for (Service in Service.Levels) {
> dbs1 <- subset( dbs,Service.Code == Service)
> if(nrow(dbs1) >2) {
> plot(density(dbs1$Enter.to.Incision))
> }}
>
> #INSIDE LOOP NO OUTPUT
> for (Service in Service.Levels) {
> dbs1 <- subset( dbs,Service.Code == Service)
> bwplot(M.Surg..Last.Name ~ Enter.to.Incision , data=dbs1)
Read FAQ 7.31
> }
>
> #AFTER LOOP AS SINGLE STATEMENT - PERFECT OUTPUT FOR LAST SERVICE
> IN LIST
> bwplot(M.Surg..Last.Name ~ Enter.to.Incision , data=dbs1)
>
> --
> View this message in context:
http://r.789695.n4.nabble.com/bwplot-in-loop-tp2220020p2220020.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
David Winsemius, MD
West Hartford, CT