3

so i thought this was super simple. I am using

![MissleadingPieChart]
(https://technaverbascripta.files.wordpress.com/2014/04/y-axis3.png)

It gives me this error and I have no idea what is wrong.

Error: unexpected '[' in "!["
packerfan
  • 31
  • 1
  • 1
  • 3
  • 1
    Works fine for me. Make sure you don't have a linebreak between the terms in angular and normal brackets. So it should be `![MissleadingPieChart](https://technaverbascripta.files.wordpress.com/2014/04/y-axis3.png)`. – Maurits Evers Oct 24 '17 at 02:55
  • I have tried the exact line of code on other peoples computers and it works fine. I had them type it in and run it then copy and paste it and send to me. I then put it in mine and it does the same errors! – packerfan Oct 24 '17 at 03:15
  • That suggests something else is wrong. You should open a new RMarkdown HTML document in RStudio, include the image at the bottom, and knit the document. If this works (and it should), the source of your error lies elsewhere. – Maurits Evers Oct 24 '17 at 03:21
  • Possible duplicate of [Insert picture/table in rmarkdown](https://stackoverflow.com/questions/25166624/insert-picture-table-in-rmarkdown) – jay.sf Oct 24 '17 at 08:34
  • @jaySf Not sure this is a duplicate. OP seems to know about how to include images in Rmd, but experiences an error. – Maurits Evers Oct 26 '17 at 03:24
  • Look like you have put this line in a chunk? – Stéphane Laurent Aug 01 '18 at 10:23

1 Answers1

12

I found that working with the following is better than the 'out-of-the-box' shorthand link-like command in rmarkdown (i.e. ![alt-Text-for-figure](url-or-folder-location). On top, it gives you some options to control the output to your liking working with a classical code chunk (e.g. out.width).

```{r figurename, echo=FALSE, fig.cap="my caption", out.width = '90%'}
knitr::include_graphics("figurename.png")
```
Ray
  • 1,554
  • 11
  • 17