Is there a way to use gplots :: textplot with tables :: tableular?

I would like to print a nice formatted table on a graphics device. I know there is textplot()

, but doesn't seem to support a feature tabular()

from the package tables

I'm using to build my table.

Is there a workaround, maybe another couple of functions that can help me here?

EDIT: Here's an example of what I'm trying to do:

dat <- data.frame(
    id=paste("id", 1:10), 
    loc=sample(c("north", "south"), 10, replace=TRUE), 
tab <- tabular(id + 1 ~ (val1 + val2)*loc*sum, data=dat)
#textplot(tab) # won't do it


(the call for tables will get more complicated, I am currently studying it step by step ...)

Any hint is appreciated! Now I'm thinking about using it text

with monospaced fonts, but maybe something better?

EDIT2: Here is the accepted solution:




source to share

3 answers

You can use capture.output

with a printed form output tabular

and then pipe the result to a text block. Or you can convert the result of the table to a matrix and pass it to the function addtable2plot

in the plotrix package.



I am working on an update gridExtra::grid.table

that will support core functionality tabular()

. You may try:

# requires gtable


enter image description here



The only graphics device I know that will possibly accept LaTeX input is tikzDevice::tikz

. You might want to include the code you are posting in tables::tabular

and we can see if the result is processed naturally.



All Articles