El error: Error in check_tpl_vars(names(data), tooltip) :
Not all variables in template are found in the data
Sucede cuando la variable tiene un nombre que contiene espacios en blanco, ej:
data <- ggplot2::diamonds
data <- data |> group_by(cut, clarity) |> summarise(total = sum(z, na.rm = T))
data$clarity <- data$total
opts <-list( theme = list())
data <- data |> rename(Mean = cut, Index of restrictive measures = total,
Global Health Security Index= clarity)
tooltip <- "{Index of restrictive measures}"
opts$theme$tooltip_template <- tooltip
opts$theme$collapse_rows = T
hgch_scatter(data,var_num = c("Index of restrictive measures", "Global Health Security Index"), var_cat = "Mean", opts=opts)