################################################### ### chunk number 1: ################################################### rdaf <- read.table(file="da04.txt", header=TRUE) ################################################### ### chunk number 2: ################################################### Adata2IndElec("da04n", rdaf$Party, rdaf$Vote,rdaf$Seat, "2004 Spanish parliamentary election$") ################################################### ### chunk number 3: ################################################### noDat <- 3*5 # number of data at the District level Parties <- gl(3,1,label=c("P1", "P2", "P3"), length=noDat) LDistri <- gl(5,3,length=noDat) # Level 4 LSubreg <- gl(2,2*3,length=noDat) # Level 3 LRegion <- rep(2,noDat) # Level 2 v <- rpois(n=noDat, lambda=20) # votes s <- rpois(n=noDat, lambda=3) # seats rdatD <- data.frame(LRegion,LSubreg,LDistri,Parties,v,s) ################################################### ### chunk number 4: ################################################### DA2IndElec("Regi2D",2, list(rdatD$LRegi,rdatD$LSubreg,rdatD$LDistri), rdatD$Parties, rdatD$v, rdatD$s, sTitle="Region2 election") ################################################### ### chunk number 5: ################################################### rOutDD <- read.csv("matrizDD.csv") rOutRL <- read.csv("matriREG.csv")