Search code examples
rhighchartsr-highcharter

R Highcharter Map Error - Parse Error Trailing Garbage


I'm loading a custom map as usual, but it ran into an error today - Error: parse error: trailing garbage. It seems like it relates to the JSON file parsing. I have tried a few other maps, but all had the same error.

Here is my code:

library(highcharter)
hcmap(map ="custom/world-highres2.js")
trying URL 'https://code.highcharts.com/mapdata/custom/world-robinson.js'
Content type 'text/javascript' length 222031 bytes (216 KB)
downloaded 216 KB

Error: parse error: trailing garbage
      [6813,7340],[6842,7341]]]}}]};
                 (right here) ------^

Solution

  • There is no definite fix but try installing the development version first:

    remotes::install_github("jbkunst/highcharter")
    
    library(highcharter) 
    
    hcmap(map ="custom/world-highres2.js")
    

    See this issue.