Tomas Alonso Rehor
Tomas Alonso Rehor

Reputation: 265

Plotting a Data Frame (no grid.table)

The question of today is pretty simple. I need to plot a Data frame so it shows in the plot viewer in R studio.

I read this Q&A already:

How to print (to paper) a nicely-formatted data frame

Where they are advising to use grid.table from GridExtra package.

The thing is that im having problem with this package as is overlapping my other plots I dont know why?

Maybe you know any other functions or package that can do the same without overlapping my other plots!

This is what I mean by overlapping.

> date_alert
          Jobs    Agency Location       Date RXH HS TMM Payed
1  Playstation Lightblue     DWTC 2015-09-24  90  8 720 FALSE
2 RWC Heineken Lightblue      EGC 2015-09-26  90  6 540 FALSE
3 Jagermeister       IHC  Barasti 2015-10-01 100  4 400 FALSE


> library(gridExtra)
> grid.table(date_alert)

enter image description here

It does that all the time! no matter how many times I restart all the script and R studio.

Thanks

Upvotes: 0

Views: 1491

Answers (1)

Roland
Roland

Reputation: 132651

If you want to plot a grid grob to a new page you need to create a new page first. The example in help("grid.table") demonstrates how to do that:

library(grid)
grid.newpage()

Note that many higher level grid-based plotting functions, such as ggplot2:::print.ggplot call grid.newpage internally. But grid.table doesn't since the common use case is adding a table to a plot. There are better possibilities if your goal is exporting just a table.

Upvotes: 1

Related Questions