-
Notifications
You must be signed in to change notification settings - Fork 0
/
06_ExploreModelMatrix.R
40 lines (30 loc) · 1.16 KB
/
06_ExploreModelMatrix.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
## ----model.matrix---------------------------------------------------------------------
## ?model.matrix
mat <- with(trees, model.matrix(log(Volume) ~ log(Height) + log(Girth)))
mat
colnames(mat)
## ----lm_example-----------------------------------------------------------------------
summary(lm(log(Volume) ~ log(Height) + log(Girth), data = trees))
## ----EMM_example1---------------------------------------------------------------------
## Load ExploreModelMatrix
library("ExploreModelMatrix")
## Example data
(sampleData <- data.frame(
genotype = rep(c("A", "B"), each = 4),
treatment = rep(c("ctrl", "trt"), 4)
))
## Let's make the visual aids provided by ExploreModelMatrix
vd <- ExploreModelMatrix::VisualizeDesign(
sampleData = sampleData,
designFormula = ~ genotype + treatment,
textSizeFitted = 4
)
## Now lets plot these images
cowplot::plot_grid(plotlist = vd$plotlist)
## ----EMM_example1_interactive, eval = FALSE-------------------------------------------
## ## We are using shiny again here
## app <- ExploreModelMatrix(
## sampleData = sampleData,
## designFormula = ~ genotype + treatment
## )
## if (interactive()) shiny::runApp(app)