-
Notifications
You must be signed in to change notification settings - Fork 0
/
hierarchy.R
55 lines (35 loc) · 1.84 KB
/
hierarchy.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#Main versión 2.
setwd("/datathon_gasto_fiscal/")
library(data.tree)
library(networkD3)
# Clasificación de Egresos
jerarq_egr_tes=read.csv("04_intermediate/jerarq_egr_tes.csv")
names(jerarq_egr_tes)<-c("ITEM","Sector")
jerarq_egr_tes$ITEM=as.character(jerarq_egr_tes$ITEM)
jerarq_egr_tes$ITEM[3]="A Otras Entidades Publicas"
jerarq_egr_tes$ITEM[6]="Amortizacion Deuda Externa"
jerarq_egr_tes$ITEM[7]="Amortizacion Deuda Externa"
jerarq_egr_tes$ITEM[8]="Compensaciones por Daños a Terceros y/o a la Propiedad "
jerarq_egr_tes$ITEM[10]="Compra de Titulos y Valore"
jerarq_egr_tes$ITEM=as.factor(jerarq_egr_tes$ITEM)
jerarq_egr_tes$pathString=paste("Clasificación de Egresos",
jerarq_egr_tes$Sector,jerarq_egr_tes$ITEM,sep="|")
useRtree <- as.Node(jerarq_egr_tes, pathDelimiter = "|")
useRtreeList <- ToListExplicit(useRtree, unname = TRUE)
bleble=radialNetwork(useRtreeList,fontSize = 15)
setwd("/datathon_gasto_fiscal/05_output/a_produccion")
saveWidget(bleble, "Clasificacion_egresos.html", selfcontained = FALSE)
setwd("/datathon_gasto_fiscal/")
# Clasificación de Ingresos
clasif_ingresos=read.csv("04_intermediate/clasif_ingresos.csv")
clasif_ingresos$Item=as.character(clasif_ingresos$Item)
clasif_ingresos$Item[25]="Participacion de Utilidades"
clasif_ingresos$Item[32]="Venta o Rescate de Titulos y Valores"
clasif_ingresos$Item=as.factor(clasif_ingresos$Item)
clasif_ingresos$pathString=paste("Clasificación de Ingresos",
clasif_ingresos$Clasif,clasif_ingresos$Item,sep="|")
useRtreeI <- as.Node(clasif_ingresos, pathDelimiter = "|")
useRtreeListI <- ToListExplicit(useRtreeI, unname = TRUE)
blabla=radialNetwork(useRtreeListI,fontSize = 15)
setwd("/datathon_gasto_fiscal/05_output/a_produccion")
saveWidget(blabla, "Clasificacion_igresos.html", selfcontained = FALSE)