I am getting the error lexical error while running the following codes
library(highcharter)
library(shiny)
ui <- fluidPage(
highchartOutput("map")
)
server <- function(input, output) {
output$map <- renderHighchart({
hcmap(
"https://code.highcharts.com/mapdata/custom/world-lowres.js") # Replace "custom/world" with your map name
})
}
shinyApp(ui, server)
I need some help on resolving it.
If you inspect
mapdatabeforefromJSON(such as withstr(mapdata)), you can see that it starts with something non-json:We need to remove everything up to and including that first
=(at character 39).More comments on your original (since-changed) question code:
See that your
gsubis not doing anything:So your initial
gsubis doing nothing because of the spaces you have around=that are not in the data. You could remove the spaces and see if that works.Bottom line, though, is that whatever you are doing here needs to be done also before you call
hcmap.