[R] pdf() and histogram() in function call

From: qian z <qianpland_at_yahoo.com>
Date: Wed, 23 Apr 2008 09:48:32 -0700 (PDT)

   Here is a function I wrote. It runs no problem, but generate empty pdf    files.

   I can't find what is the problem.

   create.pdf<- function(x, dir)

     dir.create(dir, showWarnings = FALSE)
     plist<- c("a", "b" , "c", "d")

     for(j in plist)

      filedir<- paste(dir, "/", j, ".pdf", sep="")

      form1<- as.formula(paste("~ ", j, " | var1", sep=" "))
      form2<- as.formula(paste("~ ", j, " | var2", sep=" "))
      form3<- as.formula(paste("~ ", j, " | var3", sep=" "))

      histogram(form1,data=x,type="count", xlab=j,main="Histogram conditioned
   on the levels of var1")
      histogram(form2,data=x, type="count",xlab=j,main="Histogram conditioned
   on the levels of var2")
      histogram(form3, data=x, type="count", xlab=j, main="Histogram
   conditioned on the levels of var3" )


   I have tried to find the problem, but no luck! Seriously need HELP! Thanks.

   Be a better friend, newshound, and know-it-all with Yahoo! Mobile. [1]Try it    now.


  1. http://us.rd.yahoo.com/evt=51733/*http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
    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.
Received on Wed 23 Apr 2008 - 18:09:07 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 23 Apr 2008 - 18:30:31 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive