[R] Trellis Plots: translating lattice xyplot() to ggplot()

Rich Shepard
2015-07-10T21:38:40Z

On Fri, 10 Jul 2015, Roy Mendelssohn - NOAA Federal wrote:

> Don?t know for certain but might this help:

   It's very interesting, but does not appear to resolve the immediate need
to write the R code in a knitr chunk for incorporation into the compiled LyX
document.

   The gridGraphics package description notes that both lattice and ggplot2
are built on the grid framework, and the new gridGraphics package will
'echo' either to a grid format for further tweaking. Unless the knitr
package will accept the echoed image ...

   It does not. Here is what the compiled document shows (the R code is
included in the document):

pdf('carlin-1-description.pdf')
xyplot(value ~ sampdate | variable, data=carlin.1.melt, rm.na = T)
require(gridGraphics)

## Loading required package:  gridGraphics
## Loading required package:  grid

grid.echo()

## Error in grid.echo.recordedplot(recordPlot(), newpage, prefix): No
## graphics to replay

dev.off()

Rich