X-Git-Url: http://iramuteq.org/git?a=blobdiff_plain;f=Rscripts%2FCHD.R;h=e686637656fddb91714b51bc926a9cc62a573b64;hb=8aafccab06936a00d3a134bfc7bfe7e71f8e8ea6;hp=68edd4e848d9af2d2527d14ac82998d38305afc0;hpb=8347c52224950bb01c725f9efdeee8631f8d4052;p=iramuteq diff --git a/Rscripts/CHD.R b/Rscripts/CHD.R index 68edd4e..e686637 100644 --- a/Rscripts/CHD.R +++ b/Rscripts/CHD.R @@ -1,5 +1,5 @@ #Author: Pierre Ratinaud -#Copyright (c) 2008-2011 Pierre Ratinaud +#Copyright (c) 2008-2020 Pierre Ratinaud #License: GNU/GPL pp<-function(txt,val) { @@ -229,8 +229,9 @@ CHD<-function(data.in, x=9, mode.patate = FALSE, svd.method, libsvdc.path=NULL){ print('###################################') print('longueur < 0') malcl<-length(vdelta) + if ((it>1)&&(!is.logical(listsub[[it]]))&&(!is.logical(listsub[[it-1]]))){ - if (listsub[[it]]==listsub[[(it-1)]]){ + if (all(listsub[[it]]==listsub[[(it-1)]])){ malcl<-0 } } @@ -248,14 +249,14 @@ CHD<-function(data.in, x=9, mode.patate = FALSE, svd.method, libsvdc.path=NULL){ #t2<-dtable[dtable[,'cl']==clnb+1,][,-ncol(dtable)] t1<-dtable[which(cl[,1]==clnb),]#[,-ncol(dtable)] t2<-dtable[which(cl[,1]==clnb+1),]#[,-ncol(dtable)] - if (class(t1)=='numeric') { + if (inherits(t1, "numeric")) { sc1 <- as.vector(t1) nrowt1 <- 1 } else { sc1 <- colSums(t1) nrowt1 <- nrow(t1) } - if (class(t2)=='numeric') { + if (inherits(t2, "numeric")) { sc2 <- as.vector(t2) nrowt2 <- 1 } else {