Skip to content

Commit

Permalink
adjust for changes on Wikipedia page
Browse files Browse the repository at this point in the history
  • Loading branch information
ellisp committed Sep 12, 2017
1 parent 64c5331 commit fd520b5
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/four-top-parties-all-polls.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ p <- polls %>%
ggtitle("Fifteen years of opinion polls in New Zealand",
"Intended party vote for the next election (election results shown in black)\nPolling results taken from Wikipedia, compiled in the nzelect R package")

svg("examples/all-polls-and-years.svg", 8, 6)
svg("examples/all-polls-and-years.svg", 9, 6)
print(p)
dev.off()

Expand Down
Binary file modified pkg1/data/polls.rda
Binary file not shown.
1 change: 1 addition & 0 deletions prep/combine_polls.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ polls <- plyr::rbind.fill(polls2005, polls2008, polls2011, polls2014, polls2017)
Poll = gsub("NBR.", "", Poll),
Poll = gsub("Newshub ", "", Poll),
Poll = gsub("Herald.", "", Poll),
Poll = ifelse(grepl("Colmar Brunton", Poll), "Colmar Brunton", Poll),
Poll = ifelse(grepl("Roy Morgan", Poll), "Roy Morgan", Poll),
Poll = ifelse(grepl("SSI", Poll), "SSI", Poll),
Poll = ifelse(grepl("Bauer Media Insights", Poll), "Bauer Media Insights", Poll),
Expand Down
2 changes: 1 addition & 1 deletion prep/download_polls_2017.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ tabs <- webpage %>%
html_nodes("table")

# number below depends on the webpage...
tab <- html_table(tabs[[2]], fill = TRUE)
tab <- html_table(tabs[[1]], fill = TRUE)

tab <- tab[tab[ , 1] != tab[ , 2], 1:12]
tab <- tab[tab[ , 1] != "Poll", ]
Expand Down

0 comments on commit fd520b5

Please sign in to comment.