One thing I don't think you intended, tho', is that for the contr function after each panel set is
printed, we see "Since you selected four plots per page to print, no output will be returned"
....this after the numerical output has been printed, and it repeats after each return.
I agree the current behavior is slightly confusing. By default, the other two granovaGG functions actually return a ggplot object. So, in principle, one could capture that object (through assignment) and do other things to it (such as apply ggplot2 features):
library(granovaGG)
data(arousal)
granovagg.ds(arousal[, 1:2]) -> p
p + theme_bw()
p + theme_gray()
My design approach to granovagg.contr() had to recognize that granovagg.contr() generates multiple plots. And, the default behavior most people want is for the function to lay out four plots per page. When it does so, there's no way I know of to return those pages as objects. So, I wanted users to know "if you choose to have four plots per page, the function isn't going to return any plot objects."
It WILL print those objects. But notice what happens: after assignment, p is NULL
> library(granovaGG)
> data.random <- rt(64, 5)
> granovagg.contr(data.random, contrasts = contr.helmert(8), ylab = "Random Data") -> p
Using as id variables
Linear Model Summary
Call:
lm(formula = Response ~ Contrast)
Residuals:
Min 1Q Median 3Q Max
-4.6608 -0.8368 0.1217 0.8631 2.5889
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.30124 0.15830 -1.903 0.0622 .
Contrast1 -0.04902 0.31660 -0.155 0.8775
Contrast2 -0.53174 0.36656 -1.451 0.1525
Contrast3 0.46764 0.38699 1.208 0.2320
Contrast4 -0.14635 0.40112 -0.365 0.7166
Contrast5 0.46672 0.40874 1.142 0.2584
Contrast6 0.39763 0.41406 0.960 0.3410
Contrast7 0.75387 0.41841 1.802 0.0770 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 1.266 on 56 degrees of freedom
Multiple R-squared: 0.1414, Adjusted R-squared: 0.03412
F-statistic: 1.318 on 7 and 56 DF, p-value: 0.2591
(Weighted) means, mean differences, and standardized effect size
neg pos diff stEftSze
Contrast1 -0.378 -0.47605 -0.098 -0.0774
Contrast2 -0.427 -1.22251 -0.795 -0.6281
Contrast3 -0.692 -0.06601 0.626 0.4944
Contrast4 -0.536 -0.71629 -0.181 -0.1426
Contrast5 -0.572 -0.00988 0.562 0.4437
Contrast6 -0.478 -0.01217 0.466 0.3679
Contrast7 -0.412 0.45263 0.864 0.6824
Summary statistics by group
group group.mean standard.deviation pooled.standard.deviation
1 1 -0.378009 1.0850 1.266
2 2 -0.476050 1.2406 1.266
3 3 -1.222512 2.1549 1.266
4 4 -0.066010 0.8959 1.266
5 5 -0.716293 1.3596 1.266
6 6 -0.009879 1.2411 1.266
7 7 -0.012169 0.7116 1.266
8 8 0.452635 0.8790 1.266
The contrasts you specified
[,1] [,2] [,3] [,4] [,5] [,6] [,7]
1 -1 -1 -1 -1 -1 -1 -1
2 1 -1 -1 -1 -1 -1 -1
3 0 2 -1 -1 -1 -1 -1
4 0 0 3 -1 -1 -1 -1
5 0 0 0 4 -1 -1 -1
6 0 0 0 0 5 -1 -1
7 0 0 0 0 0 6 -1
8 0 0 0 0 0 0 7
Since you elected to print four plots per page
granovagg.contr won't return any plot objects.
Examine the contrast plots and consider printing. When you're done, press <Return>
Examine the contrast plots and consider printing. When you're done, press <Return>
> str(p)
NULL
I think @rmpruzek's confusion is well-founded: if a function says it's not returning output, why would it say that after it returns printed information? I'm working on a change that makes the error message more clear. In the change, it will say:
Since you elected to print four plots per page
granovagg.contr won't return any plot objects.
Ultimately, this issue is about the difference between returning data and printing data: By default:
the originalgranova.contrprints its plots and returns summary information.
calling granovagg.contr with default values prints the plots and prints summary information
calling granovagg.contr with print.four.plots.per.page = FALSEreturns a list of plots and prints summary information
@rmpruzek points out:
I agree the current behavior is slightly confusing. By default, the other two granovaGG functions actually return a ggplot object. So, in principle, one could capture that object (through assignment) and do other things to it (such as apply ggplot2 features):
My design approach to
granovagg.contr()
had to recognize thatgranovagg.contr()
generates multiple plots. And, the default behavior most people want is for the function to lay out four plots per page. When it does so, there's no way I know of to return those pages as objects. So, I wanted users to know "if you choose to have four plots per page, the function isn't going to return any plot objects."It WILL print those objects. But notice what happens: after assignment, p is NULL
I think @rmpruzek's confusion is well-founded: if a function says it's not returning output, why would it say that after it returns printed information? I'm working on a change that makes the error message more clear. In the change, it will say:
Ultimately, this issue is about the difference between returning data and printing data: By default:
granova.contr
prints its plots and returns summary information.granovagg.contr
with default values prints the plots and prints summary informationgranovagg.contr
withprint.four.plots.per.page = FALSE
returns a list of plots and prints summary information