Search code examples
rr-markdownr-leaflet

How to suppress message of package leaflet?


I am using 'leaflet' package by R-studio to plot my geo-data. I am creating Rmarkdown file for the same.

Everything works fine. But I get following message in the beginning in Rmarkdown output file:

Assuming 'lng' and 'lat' are longitude and latitude, respectively

I have tried my best to suppress this message, but no success so far. The code:

`{r, echo=FALSE, warning=FALSE} options(warn=-1) 
long = runif(40, -87, -80) 
lat = runif(40, 25, 42) 
m = leaflet() %>% addTiles() 
df = data.frame( lng=long, lat=lat,size = runif(40, 5, 20), color = sample(colors(), 40)) 
m = leaflet(df) %>% addTiles() 
m %>% addCircleMarkers(radius = runif(40, 4, 10), color = c('red','blue','green'))`

Solution

  • You want the message option in the chunk header, e.g.

    ```{r, echo=FALSE, warning=FALSE, message=FALSE}