0

With knitr I try to product and combine two lattice plots with c.trellis(), but instead of the expected combined plot I get what looks like the internal representation of the combined trellis object:

enter image description here

MWE:

---
title: "Knitr and c.trellis"
author: "David Lindelöf"
date: "17 February 2016"
output: pdf_document
---

```{r}
foo <- xyplot(1 ~ 1)
bar <- xyplot(2 ~ 1)
c(foo, bar)
```

I have also tried calling print(c(foo, bar)) in a separate chunk, without success. Am I doing something wrong, or is this an issue with knitr?

lindelof
  • 34,556
  • 31
  • 99
  • 140
  • Ah got it. I had forgotten the call to `library(latticeExtra)` that defines the `trellis` method for `c()`. – lindelof Feb 17 '16 at 21:50

1 Answers1

0

I had forgotten to include a call to library(latticeExtra), which defined the c.trellis() method.

lindelof
  • 34,556
  • 31
  • 99
  • 140
  • You can [accept your own answer](http://stackoverflow.com/help/self-answer) if it solved your problem. (EDIT: Just realized your 12k reputation; you probaby know that ...) – CL. Feb 21 '16 at 14:53