corrections...
[iramuteq] / Rscripts / chd.R.notuse
1 #chd.R
2 source('%s')
3 source('%s')
4 source('%s')
5 source('%s')
6 classif.mode <- %i
7 file.data1 <- '%s'
8 file.data2 <- '%s'
9 file.listuce1 <- '%s'
10 file.listuce2 <- '%s'
11 file.uce <- '%s'
12 mincl <- %i
13 graph.arbre1 <- '%s'
14 graph.arbre2 <- '%s'
15 graph.dendro1 <- '%s'
16 graph.dendro2 <- '%s'
17 data.out <- %s
18
19 data1<-read.csv2(file.data1, header = FALSE)
20     
21 if (classif.mode == 0) {
22     data2<-read.csv2(file.data2, header = FALSE)
23 }        
24 chd1<-CHD(data1)
25     
26 if (classif.mode == 0) {
27     chd2<-CHD(data2)
28 } else {
29     chd2<-chd1
30 }
31     
32 #lecture des uce
33 listuce1<-read.csv2(file.listuce1)
34
35 if (classif.mode == 0) {
36     listuce2<-read.csv2(file.listuce2)
37 }
38
39 rm(data1)
40
41 if (classif.mode == 0) rm(data2)
42
43 chd.result <- Rchdtxt(file.uce,mincl=mincl,classif_mode=classif.mode)
44 n1 <- chd.result$n1
45 classeuce1 <- chd.result$cuce1
46 classeuce2 <- chd.result$cuce2
47
48 tree.tot1 <- make_tree_tot(chd1)
49 open_file_graph(graph.arbre1, widt = 600, height=400)
50 plot(tree.tot1$tree.cl)
51 dev.off()
52
53 if (classif.mode == 0) {
54     tree.tot2 <- make_tree_tot(chd2)
55     open_file_graph(graph.arbre2, width = 600, height=400)
56     plot(tree.tot2$tree.cl)
57     dev.off()
58 }          
59 tree.cut1 <- make_dendro_cut_tuple(tree.tot1$dendro_tuple, chd.result$coord_ok, classeuce1, 1)
60 classes<-n1[,9]
61 open_file_graph(graph.dendro1, width = 600, height=400)
62 plot.dendropr(tree.cut1$tree.cl,classes)
63 dev.off()
64
65 if (classif.mode == 0) {
66     tree.cut2 <- make_dendro_cut_tuple(tree.tot2$dendro_tuple, chd.result$coord_ok, classeuce2, 2)
67     open_file_graph(graph.dendro2, width = 600, height=400)
68     plot(tree.cut2$tree.cl)
69     dev.off()
70
71 save.image(file=data.out)  
72   
73   
74 (RscriptPath['CHD'], RscriptPath['chdtxt'], RscriptPath['anacor'], RscriptPath['Rgraph'])
75   
76     """ % DicoPath['TableUc1']
77   
78         """ % DicoPath['TableUc2']
79 """ % DicoPath['listeuce1']
80
81     """ % DicoPath['listeuce2']
82 """ % (DicoPath['uce'], mincl, classif_mode)
83 """%DicoPath['arbre1']
84     """ %DicoPath['arbre2']  
85 """ % DicoPath['dendro1']
86     """ % DicoPath['dendro2']
87 % DicoPath['RData']