[R] Need(?) way to create a "picture" (or "plot") of a data.frame

David Winsemius dwinsemius at comcast.net
Thu Jul 31 17:04:44 CEST 2014


On Jul 31, 2014, at 4:49 AM, John McKown wrote:

> OK, I'm probably using the wrong tool for this, but I'm doing
> everything else in this project in R, so I'm looking at how to do this
> too. I create a number of graphs using ggplot2. I use the png()
> function before the print(..graph.variable..) in order to create a PNG
> file which can be embedded in a MS PowerPoint display. This is working
> fairly well.
> 
> But what I need now is a way to create a png file which is basically a
> "picture" of what you might see when you simply display a data.frame
> using Rstudio or even from the command prompt. I considered just using
> sink() and print(), but I have two problems. First, it doesn't create
> a PNG output. Second, I need to put in text annotations, title, etc.
> So what I need might be what a "geom_data.table" would produce, if
> such a thing existed in ggplot2.


Since ggplot2 is based on grid-graphics you should also search on 'grid table text' in the usual places and with the usual tools. My favorite search engine for the Archives is Markmail and my search tool for CRAN functions is sos::findFn. I'm pretty sure that Baptiste Augie has written a function or a package to do this, and I've seen several worked examples on StackOverflow. This is something I fairly quickly found:

http://rpubs.com/baptiste/ftableGrob

-- 

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list