# NOT RUN {
## This sets up the defaults for latex to write to a pdf file
microplot::latexSetOptions()
## It is needed for R CMD check.
## It is recommended if you normally use pdflatex.
## If you want some other destination for latex, use a non-default argument.
tmp3 <- array(1:8, c(2,2,2),
list(letters[1:2],
letters[3:4],
letters[5:6]))
tmp3
ltmp3 <- latex(tmp3) ## assignment prevents display of the generated pdf file
## enter the object name to display the file on screen
## ltmp3
## latex(tmp3) causes a file tmp3.tex to be created in the working directory.
## A user might want to keep tmp3.tex and \input{tmp3.tex} it into a longer .tex file.
## R CMD check doesn't like tmp3.tex to remain, so it is removed here.
file.remove("tmp3.tex")
# }
# NOT RUN {
try( ## warning: Input rgroup and n.rgroup are ignored
latex(tmp3, rgroup=letters[1:3], n.rgroup=c(1,1,2), file="ignorergroup.tex")
)
names(dimnames(tmp3)) <- LETTERS[24:26]
latex(tmp3, file="LETTERS3.tex")
latex(tmp3, rowlabel="Something Else", file="SomethingElse.tex")
tmp4 <- array(1:120, c(5,4,3,2),
list(letters[1:5],
letters[6:9],
letters[10:12],
letters[13:14]))
tmp4
latex(tmp4, var.sep=" ; ")
names(dimnames(tmp4)) <- LETTERS[23:26]
latex(tmp4, file="LETTERS4.tex")
tmp2 <- array(1:6, c(3,2),
list(Rows=letters[1:3],
Columns=letters[4:5]))
tmp2
latex(tmp2)
## Input rgroup honored for "matrix"
latex(tmp2, rgroup=c("Two","One"), n.rgroup=c(2,1), file="rgroup.tex")
latex(tmp2, rowlabel="something else", file="something.tex")
## tableDemo is based on a table constructed from
## survey::svytable(~ FactorA + FactorB + FactorC, Survey.Design.Object)
tableDemo <- structure(c(28, 25, 33, 12, 6, 22, 8, 12, 23, 24, 6, 32,
32, 31, 59, 11, 2, 33, 10, 3, 23, 7, 2, 26),
.Dim = c(3L, 4L, 2L),
.Dimnames = list(FactorA = c("a", "b", "c"),
FactorB = c("d", "e", "f", "g"),
FactorC = c("h", "i")),
class = "table")
class(tableDemo)
latex(tableDemo)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab