在DiagrammeR中使用重音(utf8)

时间:2015-10-06 22:51:01

标签: r utf-8 diagrammer

我试图用我自己的信息使用优秀的Librarymermer库。但由于重音,我无法运行以下代码。有谁知道我怎么能通过这种类型的话?

library(DiagrammeR)

DiagrammeR("
  graph BT;
           A(Entorno familiar)-->B(Desinterés)
           B-->C(Deserción);

           style A fill:#ffffff, stroke:#04C4AB, stroke-width:1.5px;
           style B fill:#ffffff, stroke:#04C4AB, stroke-width:1.5px;
           style C fill:#ffffff, stroke:#FF5E5E, stroke-width:1.5px;
           ")

我得到的错误是:

parse error with 
       graph BT;
       A(Entorno familiar)-->B(Desinter�s)
       B-->C(Deserci�n);

       style A fill:#ffffff, stroke:#04C4AB, stroke-width:1.5px;
       style B fill:#ffffff, stroke:#04C4AB, stroke-width:1.5px;
       style C fill:#ffffff, stroke:#FF5E5E, stroke-width:1.5px;

Maximum call stack size exceeded.

我的sessionInfo是:

R version 3.2.2 (2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8 x64 (build 9200)

locale:
[1] LC_COLLATE=Spanish_Spain.1252  LC_CTYPE=Spanish_Spain.1252   
[3] LC_MONETARY=Spanish_Spain.1252 LC_NUMERIC=C                  
[5] LC_TIME=Spanish_Spain.1252    

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

other attached packages:
[1] DiagrammeR_0.7

loaded via a namespace (and not attached):
 [1] htmlwidgets_0.5  magrittr_1.5     htmltools_0.2.6  tools_3.2.2     
 [5] rstudioapi_0.3.1 yaml_2.1.13      stringi_0.5-5    jsonlite_0.9.17 
 [9] stringr_1.0.0    digest_0.6.8   

1 个答案:

答案 0 :(得分:0)

根据Pascal的建议,我审核了https://github.com/rich-iannone/DiagrammeR/issues/124,而作为sdc3,我使用了é和ó的html代码。代码运行良好。

DiagrammeR("
           graph BT;
           A(Entorno familiar)-->B(Desinterés)
           B-->C(Deserción);

           style A fill:#ffffff, stroke:#04C4AB, stroke-width:1.5px;
           style B fill:#ffffff, stroke:#04C4AB, stroke-width:1.5px;
           style C fill:#ffffff, stroke:#FF5E5E, stroke-width:1.5px;
           ")

https://drive.google.com/file/d/0B93USEgDQ_ylV29jN28xckd5cVE/view?usp=sharing