R Leaflet中的字符编码

时间:2018-12-21 13:57:27

标签: r character-encoding leaflet r-leaflet

我有一个带有多种语言值的数据框。

我正在尝试在传单地图中使用它,但是我无法使编码正常工作。

我意识到相关的编码是“ UTF-8”。

我尝试了建议使用here的解决方案,但对我而言不起作用。

最小示例代码:

options(encoding = "UTF-8")
library(leaflet)

df <- data.frame(
  name = c("Europe", "ხარებაშვილი", "喬治亞"),
  lng = c(40, 40.5, 41),
  lat = c(70, 70, 70)
)

leaflet(data = df) %>% 
  addCircleMarkers(label = ~name, labelOptions = labelOptions(permanent = T))

最小示例屏幕截图:

enter image description here

会话信息

R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] leaflet_2.0.2

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.0      digest_0.6.18   later_0.7.5     mime_0.6       
 [5] R6_2.3.0        xtable_1.8-3    jsonlite_1.6    magrittr_1.5   
 [9] promises_1.0.1  tools_3.5.1     htmlwidgets_1.3 crosstalk_1.0.0
[13] shiny_1.2.0     httpuv_1.4.5    yaml_2.2.0      compiler_3.5.1 
[17] htmltools_0.3.6

0 个答案:

没有答案