[R] pdf() and histogram() in function call
Greg Snow
Greg.Snow at imail.org
Wed Apr 23 19:00:25 CEST 2008
Read FAQ 7.22
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
(801) 408-8111
> -----Original Message-----
> From: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org] On Behalf Of qian z
> Sent: Wednesday, April 23, 2008 10:49 AM
> To: r-help at r-project.org
> Subject: [R] pdf() and histogram() in function call
>
>
> 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=" "))
> pdf(filedir)
>
> 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" )
>
> dev.off()
> }
>
>
> }
>
>
> 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.
>
> References
>
> 1.
> http://us.rd.yahoo.com/evt=51733/*http://mobile.yahoo.com/;_yl
t=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.
>
More information about the R-help
mailing list