Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

knitR error with plotly layout

I’m not able to fix this problem. Whenever I try to upload my knitR markdown I get the following error:

This is my code:

df$hover <- with(df, paste(Country,'<br>',  "New Sessions (%)", `New Sessions`, '<br>', "New Users", `New Users`, '<br>', "Bounce Rate (%)", `Bounce Rate`, '<br>', "Avg. Session Duration (sec)", `Avg. Session Duration`))

# give state boundaries a white border
l <- list(color = toRGB("grey"), width = 0.5)
# specify some map projection/options
g <- list(
  showframe = FALSE,
  showcoastlines = FALSE,
  projection = list(type = 'Mercator')
)

 plot_ly(df, z = Sessions, text = hover, locations = country.code, type = 'choropleth',
     color = Sessions, colors = 'Blues', marker = list(line = l),
     colorbar = list(title = 'Sessions'))  %>%
     layout(title = '#  of Sessions Aug 1 - Aug 30<br>(Hover for breakdown)', geo = g)

And here what the plot looks like: https://plot.ly/~slackoverflow/53/of-sessions-aug-1-aug-30-hover-for-breakdown/

When I remove the layout part, everything is alright. In R Studio I can run the Code with layout without any probs. Just when trying to format it to HTML it doesn’t work. Been googling this for a while, and couldn’t find any solution. I’d really appreciate any help on this.