packerfan
packerfan

Reputation: 51

Bringing an image into Rmarkdown

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 "!["

Upvotes: 5

Views: 16520

Answers (2)

waltherk
waltherk

Reputation: 1

I had this problem too. I was hitting ctrl+enter and running it in console instead of pressing ctrl+shift+K to knit it to a html file.

Upvotes: 0

Ray
Ray

Reputation: 2268

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")
```

Upvotes: 13

Related Questions