Intro

Here I am gonna retrive data from a wikipage and analyze it.

Turkish elections on November 1st 2015 will start in about 5 hours or so.

I found a wikipage that reports many survey results, I decided to run a meta analyses to see a single outcome for each political party. see

library(XML)
library(RCurl)
webpage <- getURL("https://tr.wikipedia.org/wiki/Kas%C4%B1m_2015_T%C3%BCrkiye_genel_se%C3%A7imleri_i%C3%A7in_yap%C4%B1lan_anketler", .opts = list(ssl.verifypeer = FALSE) )
doc <- readHTMLTable(doc=webpage)
names(doc)

#here I will select only the surveys conducted on October 2015, which are the
#first 25 lines
data=data.frame(doc[[1]][1:25,3:7])
names(data)=c("sayi","akp","chp","mhp","hdp")

#more cleaning
data=data.frame(apply(apply(data, 2, gsub, patt=",", replace="."), 2, as.numeric))
head(data)
str(data)
data2=data[!is.na(data$sayi),]

#exclude AKAM
# AKAM conducted its servey with 20000+ people, its quite large compared to others,
# excluding it from the data should affect the results
data3=data2[-7,]

library(meta)
## AKAM excluded

#yea, a loop would be cool below, i know, but i am too sleepy, no one pays me for #this, #and i am out of apples 

#akp   
metaprop(as.integer((data3$sayi*data3$akp)*10),(data3$sayi)*1000)
#0.4235 [0.4197; 0.4273]

## AKAM included
metaprop(as.integer((data2$sayi*data2$akp)*10),(data2$sayi)*1000)
#0.4183 [0.4151; 0.4215]

#chp
metaprop(as.integer((data3$sayi*data3$chp)*10),(data3$sayi)*1000)
#0.2680 [0.2646; 0.2714]

metaprop(as.integer((data2$sayi*data2$chp)*10),(data2$sayi)*1000)
#0.2719 [0.2690; 0.2748]

#mhp
metaprop(as.integer((data3$sayi*data3$mhp)*10),(data3$sayi)*1000)
#0.1505 [0.1478; 0.1533]

metaprop(as.integer((data2$sayi*data2$mhp)*10),(data2$sayi)*1000)
#0.1486 [0.1463; 0.1509]

#hdp
metaprop(as.integer((data3$sayi*data3$hdp)*10),(data3$sayi)*1000)
#0.1271 [0.1245; 0.1297]
metaprop(as.integer((data2$sayi*data2$hdp)*10),(data2$sayi)*1000)
#0.1312 [0.1290; 0.1335]