'Can't suppress error message in R Markdown?
I'm making a tutorial using RMarkdown and I can't suppress the error message I'm getting. The reason I'm suppressing the error is because the code I'm running requires an API key and I'm intentionally leaving it out. I just want to display the code, I know it won't work since I'm not using real API key:
```{r results='hide', error=TRUE, warning=FALSE, message=FALSE}
token <- "xxxxxxxxxxxxxxxxxxxxxxxxxxx" #this is your secret token
url <- "myurl.com" #this is your URL
result <- postForm(
uri=url, #pass in url
token=token, #pass in token
content='record',
format='csv',
type='flat'
)
```
I have message=FALSE
but the error messages are still showing up when I knit to HTML! How can I simply display the code above?
Solution 1:[1]
Use
{r eval = FALSE}
. This will stop the code from running.
Here is the code:
```{r eval = FALSE}
token <- "xxxxxxxxxxxxxxxxxxxxxxxxxxx" #this is your secret token
url <- "myurl.com" #this is your URL
result <- postForm(
uri=url, #pass in url
token=token, #pass in token
content='record',
format='csv',
type='flat'
)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | ViviG |