SachaEpskamp / qgraph

Developmental version of qgraph
GNU General Public License v2.0
68 stars 21 forks source link

qgraph error with non-ACSII symbols #1

Closed artemklevtsov closed 9 years ago

artemklevtsov commented 9 years ago

Hi.

I have some troubles with the objects which names are not English.

> adj <- matrix(sample(0:1, 3^2, TRUE, prob = c(0.8, 0.2)), nrow = 3, ncol = 3)
> dimnames(adj) <- list(c("Аб", "Вг", "Ед"),  c("Аб", "Вг", "Ед"))
> adj
   Аб Вг Ед
Аб  0  1  1
Вг  0  0  0
Ед  0  1  0
> qgraph(adj)

(process:8196): Pango-WARNING **: Invalid UTF-8 string passed to pango_layout_set_text()

(process:8196): Pango-WARNING **: Invalid UTF-8 string passed to pango_layout_set_text()

(process:8196): Pango-WARNING **: Invalid UTF-8 string passed to pango_layout_set_text()

(process:8196): Pango-WARNING **: Invalid UTF-8 string passed to pango_layout_set_text()

Session info:

> sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=ru_RU.UTF-8       LC_NUMERIC=C               LC_TIME=ru_RU.UTF-8        LC_COLLATE=ru_RU.UTF-8    
 [5] LC_MONETARY=ru_RU.UTF-8    LC_MESSAGES=ru_RU.UTF-8    LC_PAPER=ru_RU.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=ru_RU.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] qgraph_1.3   magrittr_1.5

loaded via a namespace (and not attached):
 [1] acepack_1.3-3.3     cluster_2.0.1       colorspace_1.2-4    corpcor_1.6.7       d3Network_0.5.2.1   digest_0.6.8       
 [7] ellipse_0.3-8       fdrtool_1.2.13      foreign_0.8-62      Formula_1.2-0       ggm_2.3             ggplot2_1.0.0      
[13] glasso_1.8          grid_3.1.2          gtable_0.1.2        gtools_3.4.1        Hmisc_3.14-6        huge_1.2.6         
[19] igraph_0.7.1        jpeg_0.1-8          lattice_0.20-29     latticeExtra_0.6-26 lavaan_0.5-17       MASS_7.3-37        
[25] Matrix_1.1-5        matrixcalc_1.0-3    mnormt_1.5-1        munsell_0.4.2       nnet_7.3-8          parallel_3.1.2     
[31] pbivnorm_0.6.0      pixmap_0.4-11       plyr_1.8.1          png_0.1-7           proto_0.3-10        psych_1.5.1        
[37] quadprog_1.5-5      RColorBrewer_1.1-2  Rcpp_0.11.4         reshape2_1.4.1      rjson_0.2.15        rpart_4.1-8        
[43] rtiff_1.4.4         scales_0.2.4        sem_3.1-5           sendplot_4.0.0      sna_2.3-2           splines_3.1.2      
[49] stats4_3.1.2        stringr_0.6.2       survival_2.37-7     tools_3.1.2         whisker_0.3-2      
SachaEpskamp commented 9 years ago

Thanks for this report. There was a bug in the automatic abbreviation that occurs on labels supplied as column-names of the input matrix. I now included in the GitHub version a check on this. Also, you can circumvent this behavior using the labels argument:

adj <- matrix(sample(0:1, 3^2, TRUE, prob = c(0.8, 0.2)), nrow = 3, ncol = 3)
library("qgraph")
qgraph(adj, labels = c("Аб", "Вг", "Ед"))
artemklevtsov commented 9 years ago

Above example works with the git-version. Thanks.