I would like to print a nice formatted table to a graphics device. I am aware there is textplot(), however it seems not to support the tabular() function from the tables package, which I use to assemble my table.
Is there a workaround, maybe another pair of functions that can help me here?
EDIT:
Here is an example of what I am trying to do:
dat <- data.frame(
id=paste("id", 1:10),
loc=sample(c("north", "south"), 10, replace=TRUE),
val1=rnorm(10),
val2=rnorm(10)
)
tab <- tabular(id + 1 ~ (val1 + val2)*loc*sum, data=dat)
#textplot(tab) # won't do it
(The call to tabular will become more complex, I am currently learning it step by step…)
Any hint appreciated! I am now thinking of using text with a monospaced fonts, but maybe there is something better?
EDIT2:
Here is the accepted solution:
textplot(capture.output(tab))
You could use
capture.outputwith the printed form of thetabularoutput then pass the result to textplot. Or you could convert the result of tabular to a matrix and pass that to theaddtable2plotfunction in the plotrix package.