0

I have a .rpres file "Introduction to R.rpres". I use the preview mode in Rstudio to generate a presentation with several slides.

The following code enclosed by 3 ticks at the beginning and end

```{r,out.width='\\textwidth', fig.height = 8, fig.align='center'}
plot(NINDS_minimal_t_PA$NIHSSB, NINDS_minimal_t_PA$Dead)
abline(lmdeath_tpa)

Produces a plot on the slide

The following code

```{r,out.width='\\textwidth', fig.height = 8, fig.align='center'}
plot(NINDS_minimal_t_PA$NIHSSB, NINDS_minimal_t_PA$Dead)
lines(NIHSStest, Prop_dead)

produces message shown below as a slide. But no plot is generated

<img src="Introduction R-figure/unnamed-chunk-37-1.png" title="plot of chunk unnamed chunk-37" alt="plot of chunk unnamed-chunk-37" width="\textwidth" style="display: block;margin:auto;" ">/

How would I be able to generate a plot without the message?

Phil
  • 7,287
  • 3
  • 36
  • 66
abcihep
  • 33
  • 8
  • That doesn't look like an error message--it doesn't say "Error" anywhere. It looks like HTML code to have an image. – Gregor Thomas Sep 10 '21 at 19:28
  • Edited the post. – abcihep Sep 10 '21 at 19:30
  • Can you make your example reproducible? I created a new Rpres document and edited the default "Slide with plot" code chunk to be `\`\`\`{r, out.width='\\textwidth', fig.height = 8, fig.align = 'center'} plot(cars) lines(cars$speed, cars$dist)\`\`\``, and it works fine. – Gregor Thomas Sep 10 '21 at 20:31
  • And can you verify that the command `lines(NIHSStest, Prop_dead)` works generally? It's surprising that you are using `data$column` in the `plot()` call, but not in `lines`. Are you sure that `NIHSStest` and `Prop_dead` are vectors defined inside your Rpres document? – Gregor Thomas Sep 10 '21 at 20:34
  • NIHSStest is a vector of length 40. Prop_dead is a vector of equal length obtained as output of predict(model, list (NIHSSB=NIHSStest), type="response") – abcihep Sep 10 '21 at 22:45

0 Answers0