Skip to content

Commit c0c513a

Browse files
committed
download formatting for > 3 models
1 parent 9ec5e94 commit c0c513a

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

server.R

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ observe({
794794
# values$modelcoefs is a list object, each element is a list of
795795
# coefficients and stars for a single model
796796
m <- values$modeltotal
797-
if(m > 0 & m < 5){
797+
if(m > 0 & m <= 5){
798798
values$modelcoefs[[m]] <- isolate(ergminfo(model1reac()))
799799
values$modelformulas[[m]] <- isolate(ergm.terms())
800800
values$modelfits[[m]] <- isolate(model1reac())
@@ -2880,7 +2880,13 @@ output$gofplotcompdownload <- downloadHandler(
28802880
lastelt <- 15
28812881
bottommat <- c(0,(n*cols+1):(n*cols+3))
28822882
bottomtext <- c("degree","espartners","distance")
2883-
pdf(file=file, height=8.5, width=11)
2883+
if(n<=4){
2884+
#landscape page
2885+
pdf(file=file, height=8.5, width=11)
2886+
} else {
2887+
#portrait page
2888+
pdf(file=file, height=11, width=8.5)
2889+
}
28842890
} else {
28852891
cols <- 1
28862892
lastelt <- 7
@@ -2896,14 +2902,15 @@ output$gofplotcompdownload <- downloadHandler(
28962902
if(n<3){
28972903
extra <- 3-n
28982904
last <- sidemat[length(sidemat)]
2899-
m <- matrix((last+1):lastelt, nrow=extra, byrow=TRUE)
2900-
layoutmat <- rbind(layoutmat, bottommat, m)
2905+
filler <- matrix((last+1):lastelt, nrow=extra, byrow=TRUE)
2906+
layoutmat <- rbind(layoutmat, bottommat, filler)
2907+
heights <- c(rep(3,n),1,rep(3,3-n))
29012908
} else {
29022909
layoutmat <- rbind(layoutmat, bottommat)
2910+
heights <- c(rep(3,n),1)
29032911
}
29042912

2905-
widths <- c(1,rep(3,cols))
2906-
heights <- c(rep(3,n),1,rep(3,3-n))
2913+
widths <- c(1,rep((9/cols),cols))
29072914
layout(layoutmat, widths=widths, heights=heights)
29082915
par(mar=c(1,2,2.2,1), omi=c(0,0,.3,0))
29092916

@@ -2925,6 +2932,7 @@ output$gofplotcompdownload <- downloadHandler(
29252932
text(x=.7,y=.5,labels=sidetext[j], srt=90, cex=1.5)
29262933
}
29272934
mtext("Goodness-of-fit diagnostics",side=3,outer=TRUE,cex=1.5,padj=0)
2935+
29282936
dev.off()
29292937
}
29302938
)

0 commit comments

Comments
 (0)