X-Git-Url: http://iramuteq.org/git?a=blobdiff_plain;f=PrintRScript.py;h=ca88660efb425fc36908923e07124746d7064743;hb=dac789bedd0b3867a7749b1d71bc7868c44642f7;hp=27c4d272baa6bfd0f84ae4157f73aeeab1f6c6aa;hpb=eaa044d1147e26b82942ce56d5965c83fdddf069;p=iramuteq diff --git a/PrintRScript.py b/PrintRScript.py index 27c4d27..ca88660 100755 --- a/PrintRScript.py +++ b/PrintRScript.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- #Author: Pierre Ratinaud -#Copyright (c) 2008-2020 Pierre Ratinaud -#modification pour python 3 : Laurent Mérat, 6x7 - mai 2020 +#Copyright (c) 2008-2011 Pierre Ratinaud #License: GNU/GPL #------------------------------------ @@ -1173,7 +1172,7 @@ class PrintSimiScript(PrintRScript): if (!is.null(graph.simi$com)) { com <- graph.simi$com colm <- rainbow(length(com)) - if (vertex.size != 0 || graph.simi$halo) { + if (sum(vertex.size) != 0 || graph.simi$halo) { vertex.label.color <- 'black' vertex.col <- colm[membership(com)] } else { @@ -1385,6 +1384,17 @@ class LabbeScript(PrintRScript): tab <- read.csv2("%s", header=TRUE, sep=';', row.names=1) """ % (ffr(self.pathout['tableafcm.csv'])) txt += """ + cs <- colSums(tab) + if (min(cs) == 0) { + print('empty columns !!') + vide <- which(cs==0) + print(vide) + tab <- tab[,-vide] + } + #print('#### RcppIramuteq for C++ Labbe ####') + #library(RcppIramuteq) + #dist.mat <- labbe(as.matrix(tab)) + #rownames(dist.mat) <- colnames(tab) dist.mat <- dist.labbe(tab) dist.mat <- as.dist(dist.mat, upper=F, diag=F) write.table(as.matrix(dist.mat), "%s", sep='\t')