Этот подход должен работать с категориями.
library(highcharter)
library(tidyverse)
mapData <- data.frame(
country = c("CN", "JP", "SG", "DZ", "AU"),
fruit = c("apple", "banana", "apple", "apple", "orange")
)
series <- mapData %>%
group_by(name = fruit) %>%
do(data = list_parse(select(., country))) %>%
ungroup() %>%
mutate(color = c("green", "yellow", "orange"))
map <- download_map_data("custom/world")
highchart(type = "map") %>%
hc_plotOptions(map = list(
allAreas = FALSE,
joinBy = c("iso-a2", "country"),
mapData = map
)) %>%
hc_add_series_list(series)
Карта