[R] bwplot in loop
GL
pflugg at shands.ufl.edu
Mon May 17 19:36:24 CEST 2010
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)
}
#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.
More information about the R-help
mailing list