R/pe_pdf_grid.R

Defines functions pe_pdf_grid

Documented in pe_pdf_grid

pe_pdf_grid <- function(model, terms, maxcol=2, maxrow=3, ...)
{  
################################################################# 
define_region <- function(row, col){
    viewport(layout.pos.row=row, layout.pos.col=col) }
#################################################################  
# function starts
     lterms <- length(terms)
if (lterms  >   maxcol*maxrow) stop("increase the maxcol or maxrow")   
if (lterms  <= 1) stop("only one term use pe_pdf()")
     norow <- ceiling(lterms/maxcol)
nocol <- if (norow == 1)  lterms  else  maxcol    
       IJ <- expand.grid(j=1:nocol, i=1:norow)
grid.newpage()
pushViewport(viewport(layout=grid.layout(nrow=norow,ncol=nocol)))   
     GG <- list()
# for (i in xs ) gg[[i]] <-pe_pdf(linear_3, term=i, title=i)
for (p  in 1:lterms) 
    {
      GG[[terms[[p]]]] <- pe_pdf(model, term=terms[[p]], title=terms[[p]],...)
      print(GG[[terms[[p]]]], vp=define_region(IJ$i[p], IJ$j[p]))
    }
}

Try the gamlss.ggplots package in your browser

Any scripts or data that you put into this service are public.

gamlss.ggplots documentation built on May 29, 2024, 1:34 a.m.