Code Monkey home page Code Monkey logo

eechidna's Introduction

eechidna

CRAN_Status_Badge Travis-CI Build Status AppVeyor Build Status

Exploring Election and Census Highly Informative Data Nationally for Australia

The R package eechidna provides data from the Australian Federal elections in 2001, 2004, 2007, 2010, 2013, 2016, 2019 and 2022 along with the Australian Census information for each House of Representatives electorate from the 2001, 2006, 2011 and 2016 Censuses. Additionally, Census information is imputed for electorates in years 2004, 2007, 2010, 2013 and 2019. It also includes tools for visualizing and analysing the data.

This package was developed during the rOpenSci auunconf event in Brisbane, Queensland, during 21-22 April 2016. It has been updated many times since to include election and Census information for 2001, 2011 and 2019. Peter Ellis’ work on the NZ electoral data was an important inspiration for this package.

You can find out more about eechidna here: https://jforbes14.github.io/eechidna/

How to install

You can install the latest release of the package from CRAN like this

install.packages("eechidna")

Or you can install the development version from github, which may have some changes that are not yet on CRAN, using devtools, like this:

devtools::install_github("jforbes14/eechidna", 
                         build_vignettes = TRUE)
library(eechidna)

If you are using Linux, you may need some additional libraries for the mapping functions, you can get these with this line:

apt-get install libgdal-dev libgeos-dev -y

How to use

The package consists of several datasets, which includes Australian Census data at electorate level, Australian Federal election (House of Representatives) voting data from electorates and polling booths, and shapefiles for Australian electoral districts at various points in time. In addition to the data provided, eechidna includes a highly interactive web app for exploring the election and census data together. This app uses the shiny framework, and can be run locally on your computer with the command eechidna::launchApp(). There is a video demo of the app here: https://vimeo.com/167367369.

We have many vignettes that show how to access these data in the package, and demonstrate how to analyse the data using R. These can be found in the articles tab at the top of this page.

There are also three vignettes that demonstrate how to use the spatial data to make maps. Mapping election data for Australia is not trivial because of the extreme variation in electorate size. In these vignettes we show some methods for effectively visualizing election data in Australia. These too are found in the articles tab at the top of this page.

Additionally, there is a vignette on how we have imputed electoral Census data in election years for which a Census does not exactly align.

License

This package is free and open source software, licensed under GPL (>= 2).

Feedback, contributing, etc.

Please open an issue if you find something that doesn’t work as expected or have questions or suggestions. Note that this project is released with a Guide to Contributing and a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Acknowledgements

Thanks to Xiaoyue Cheng for her cartogram package which supplies the Dorling algorithm for this package. Thanks also to Roger Bivand for his rgdal and rgeos packages which has some key functions for working with shapefiles. Thanks to Scott Chamberlain and Yihui Xie for help with troubleshooting.

eechidna's People

Contributors

anthonyebert avatar benmarwick avatar bryceroney avatar cpsievert avatar dicook avatar earowang avatar emitanaka avatar heike avatar jforbes14 avatar njtierney avatar robjhyndman avatar tslumley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

eechidna's Issues

R CMD check

Check the package build again, that example code delimited by \dontrun, might be made to run, in the package submission to CRAN.

The `area_sqkm` is incorrect for 2019 map data?

library(tidyverse)
library(eechidna)

# 2016 (looks correct)

nat_map16 <- nat_map_download(2016) 
nat_data16 <- nat_data_download(2016)

nat_map16 %>% 
  left_join(nat_data16, by = "elect_div") %>% 
  ggplot() + 
  geom_polygon(aes(x = long, y = lat, group = group, fill = area_sqkm), color = "black") +
  theme(legend.position="bottom") + theme_void() + coord_equal() 

# 2019 (something wrong)

nat_map19 <- nat_map_download(2019) 
nat_data19 <- nat_data_download(2019)

nat_map19 %>% 
  left_join(nat_data19, by = "elect_div") %>% 
  ggplot() + 
  geom_polygon(aes(x = long, y = lat, group = group, fill = area_sqkm), color = "black") +
  theme(legend.position="bottom") + theme_void() + coord_equal() 

Created on 2020-04-18 by the reprex package (v0.3.0)

Add another view to shiny app

We have space for at least one more view in the top row of the shiny app (the same row as the map and the proportions by party). Any ideas on what we should show?

Unable to install the package

Hi there,

I am following the instructions at (https://jforbes14.github.io/eechidna/index.html) to install the package but I have no success.

install.packages("eechidna")
# Warning in install.packages :
#   package ‘eechidna’ is not available for this version of R
devtools::install_github("jforbes14/eechidna", build_vignettes = TRUE)
# Using GitHub PAT from the git credential store.
# Downloading GitHub repo jforbes14/eechidna@HEAD
# Error in utils::download.file(url, path, method = method, quiet = quiet,  : 
#   download from 'https://api.github.com/repos/jforbes14/eechidna/tarball/HEAD' failed
> sessionInfo()
# R version 4.3.3 (2024-02-29)
# Platform: aarch64-apple-darwin20 (64-bit)
# Running under: macOS Ventura 13.0.1

I appreciate your help and assistance.

Thanks.
Omid

Non-Affiliated candidates dropped from 2016 AEC dataset

I have found a discrepancy in total number of observations between the aec2016_fp dataset and an import from the AEC spreadsheets. The aec2016_fp dataset contains 83 fewer observations.

The issue appears to be two non affiliated candidates with PartyAB = NAFD and PartyNm = N/A who have been dropped from the aec2016_fp data in Longman and Lindsay.

> glimpse(datadiff)
Observations: 83
Variables: 26
$ DivisionID         <int> 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128...
$ DivisionNm         <chr> "Lindsay", "Lindsay", "Lindsay", "Lindsay", "Lindsay", "Lindsay", "Lindsay", "Linds...
$ PollingPlaceID     <int> 1747, 65411, 1479, 1480, 1481, 1754, 11957, 384, 1758, 1478, 30119, 1483, 1484, 149...
$ PollingPlace       <chr> "Berkshire Park", "BLV Lindsay PPVC", "Cambridge Gardens", "Cambridge Park", "Cambr...
$ CandidateID        <int> 28025, 28025, 28025, 28025, 28025, 28025, 28025, 28025, 28025, 28025, 28025, 28025,...
$ Surname            <chr> "CORNISH", "CORNISH", "CORNISH", "CORNISH", "CORNISH", "CORNISH", "CORNISH", "CORNI...
$ GivenNm            <chr> "Marcus", "Marcus", "Marcus", "Marcus", "Marcus", "Marcus", "Marcus", "Marcus", "Ma...
$ BallotPosition     <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,...
$ Elected            <chr> "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N"...
$ HistoricElected    <chr> "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N", "N"...
$ PartyAb            <chr> "NAFD", "NAFD", "NAFD", "NAFD", "NAFD", "NAFD", "NAFD", "NAFD", "NAFD", "NAFD", "NA...
$ PartyNm            <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
$ OrdinaryVotes      <int> 8, 0, 56, 63, 55, 13, 48, 54, 116, 92, 8, 35, 71, 39, 45, 52, 13, 24, 15, 35, 19, 1...
$ Swing              <dbl> 2.12, 0.00, 2.50, 2.96, 4.43, 1.51, 2.53, 1.99, 3.40, 3.48, 1.50, 2.30, 2.90, 2.82,...
$ State              <chr> "NSW", "NSW", "NSW", "NSW", "NSW", "NSW", "NSW", "NSW", "NSW", "NSW", "NSW", "NSW",...
$ PollingPlaceTypeID <int> 1, 5, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 1,...
$ PollingPlaceNm     <chr> "Berkshire Park", "BLV Lindsay PPVC", "Cambridge Gardens", "Cambridge Park", "Cambr...
$ PremisesNm         <chr> "Berkshire Park Bushfire Shed", "BLV Lindsay", "Cambridge Gardens Public School", "...
$ PremisesAddress1   <chr> "Sixth Rd", "Ground Floor", "Trinity Dr", "Oxford St", "Harrow Rd", "Post Office Rd...
$ PremisesAddress2   <chr> NA, "606 High St", NA, NA, NA, NA, NA, NA, NA, NA, "606 High St", NA, NA, NA, NA, N...
$ PremisesAddress3   <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
$ PremisesSuburb     <chr> "BERKSHIRE PARK", "PENRITH", "CAMBRIDGE GARDENS", "CAMBRIDGE PARK", "CAMBRIDGE PARK...
$ PremisesStateAb    <chr> "NSW", "NSW", "NSW", "NSW", "NSW", "NSW", "NSW", "NSW", "NSW", "NSW", "NSW", "NSW",...
$ PremisesPostCode   <int> 2765, 2750, 2747, 2747, 2747, 2749, 2747, 2760, 2749, 2749, 2750, 2750, 2750, 2750,...
$ Latitude           <dbl> -33.67690, -33.75202, -33.73733, -33.74800, -33.75230, -33.66752, -33.77375, -33.78...
$ Longitude          <dbl> 150.7810, 150.6906, 150.7230, 150.7260, 150.7340, 150.6770, 150.7461, 150.7910, 150...

dorling cartogram in shiny app

Get the dorling cartogram version of the electorates with a map background into app as an alternative to the hexagon - to be able to choose either on startup?

nat_map_download() doesn't download map

Hi team!

It looks like there's a little problem with the nat_map_download().

Running nat_map16 <- nat_map_download(2016), returns instructions to run the same thing again when running nat_map16.

Cheers,
Quang

NAs in the 2019 maps

There are some weird NAs in the 2019 maps that are not in the 2016 map. Are these a problem?

library(dplyr)
library(eechidna)
nat_map16 = nat_map_download(2016)
glimpse(nat_map16)
#> Rows: 37,041
#> Columns: 9
#> $ long      <dbl> 130.5179, 130.5175, 130.5294, 130.5243, 130.5310, 130.5252,…
#> $ lat       <dbl> -12.73105, -12.72562, -12.72505, -12.73409, -12.74217, -12.…
#> $ order     <int> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, …
#> $ hole      <lgl> FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FAL…
#> $ piece     <chr> "P.1", "P.1", "P.1", "P.1", "P.1", "P.1", "P.1", "P.1", "P.…
#> $ id        <chr> "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",…
#> $ group     <chr> "G.1.1", "G.1.1", "G.1.1", "G.1.1", "G.1.1", "G.1.1", "G.1.…
#> $ elect_div <chr> "LINGIARI", "LINGIARI", "LINGIARI", "LINGIARI", "LINGIARI",…
#> $ state     <chr> "NT", "NT", "NT", "NT", "NT", "NT", "NT", "NT", "NT", "NT",…
sum(is.na(nat_map16$elect_div))
#> [1] 0
nat_map19 = nat_map_download(2019)
glimpse(nat_map19)
#> Rows: 33,427
#> Columns: 9
#> $ long      <dbl> 149.2063, 149.1382, 149.1551, 149.1355, 149.1515, 149.1314,…
#> $ lat       <dbl> -35.34591, -35.42940, -35.43578, -35.45442, -35.49224, -35.…
#> $ order     <int> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, …
#> $ hole      <lgl> FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FAL…
#> $ piece     <chr> "P.1", "P.1", "P.1", "P.1", "P.1", "P.1", "P.1", "P.1", "P.…
#> $ id        <chr> "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0",…
#> $ group     <chr> "G.0.1", "G.0.1", "G.0.1", "G.0.1", "G.0.1", "G.0.1", "G.0.…
#> $ elect_div <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
#> $ state     <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
sum(is.na(nat_map19$elect_div))
#> [1] 92

Note that there are some geographic objects whose elect_div and state columns are NA in 2019 only.
This is different to the 2016 version, which seems to always have content there.
I'm not yet geo-savvy enough to know exactly how to parse these weird geographic data frames, but if I work this out while playing with the data I'll post more information.

dependency on retiring spatial infrastructure packages

You will be aware, for example from:
https://r-spatial.org/r/2022/04/12/evolution.html,
https://r-spatial.org/r/2022/12/14/evolution2.html,
https://r-spatial.org/r/2023/04/10/evolution3.html and
https://rsbivand.github.io/csds_jan23/bivand_csds_ssg_230117.pdf and
perhaps view https://www.youtube.com/watch?v=TlpjIqTPMCA&list=PLzREt6r1NenmWEidssmLm-VO_YmAh4pq9&index=1
that rgdal, rgeos and maptools will be retired this
year, in October 2023.

eechidna imports rgeos, rgdal and seems from pkgapi to use rgdal::ogrListLayers rgdal::readOGR rgeos::gArea rgeos::gContains rgeos::gIntersection rgeos::gIntersects rgeos::gSimplify. Please refer to links in https://r-spatial.org/r/2023/04/10/evolution3.html for hints on replacements, especially the renderings of ASDAR using sf. Please update best by June, latest October 2023.

Try running CMD check under a scenario using sp evolution status 2 (substitute use of rgdal with sf for projection/transformation/CRS) and absence of retiring packages from the library path.

erratic build error: "Value of SET_STRING_ELT() must be a 'CHARSXP' not a 'character'"

On 2 July I got this email from CRAN:

Dear maintainer,

Pls see the problems shown on
https://cran.r-project.org/web/checks/check_results_eechidna.html:

Can you pls fix as necessary?

Best,
-k

I took at look at the page referred to and I see:

clipboard-cran

And the key details are:

Quitting from lines 155-172 (exploring-election-data.Rmd) Error: processing vignette ‘exploring-election-data.Rmd’ failed with diagnostics: Value of SET_STRING_ELT() must be a 'CHARSXP' not a 'character' Execution halted

Searching online for this error I see that it's related to R's internals, maybe something in the C++ used by dplyr, no obvious fixes or workarounds are available.

I took a closer look into the specific error, and the locus of the problem is in these lines, in the chunk at lines 155-172 of exploring-election-data.Rmd):

dplyr::mutate(prop_votes = round(sum_votes / sum(sum_votes), 3),
              sum_votes = as.character(prettyNum(sum_votes, ","))) 

Here's a self-contained working example that may or may not generate the error (I've split each line out as a separate code chunk in an Rmd here:

library(eechidna)
  aec2013_fp %>% 
  dplyr::filter(CandidateID != 999) %>%  #exclude informal votes
  dplyr::mutate(candidate_full_name = 
                  paste0(GivenNm, " ", Surname, " (", CandidateID, ")"))  %>% 
  dplyr::group_by(Electorate, candidate_full_name) %>% 
  dplyr::summarise(sum_votes = sum(OrdinaryVotes)) %>% 
  dplyr::mutate(prop_votes = round(sum_votes / sum(sum_votes), 3),
                sum_votes = as.character(prettyNum(sum_votes, ","))) %>% 
  dplyr::ungroup() %>% 
  dplyr::arrange(dplyr::desc(prop_votes)) %>% 
  head() %>% 
  knitr::kable()

If I try to extract sum_votes after that line, for example with my_df$sum_votes, then I get the 'CHARSXP" error.

The problem is that I can't reliably reproduce this. Fifty runs consecutive of devtools::check() gives failed builds 29/50 times, builds with warning 1/21 times, and 20 builds with no warning. Similar results with smaller scale testing on devtools::build_win() and rhub::check_for_cran(). So I don't really know what to target.

I'm not sure where to go from here, suggestions welcome!

Imputing electorates - Error when calling weighted_avg_census_sa1

Hello,

Firstly, thanks for creating this awesome package. It really makes working with electoral data and census data easy and enjoyable!

I am planning to add some additional variables from the Census data to my data frames, which currently consist of eechidna abs and some variations of the aec variables. For the years when there was an election but no census, I have decided to follow the imputation strategy that you have introduced. Hence, I tested whether I can replicate the code on imputation vignette. I got an error message (Error: object 'CD' not found) after calling weighted_avg_census_sa1 on the mapping. See the code and error message below. I also got warnings after calling allocate_electorate, which I have attached below. I tried the weighted_avg_census_sa1 also with a data frame consisting of one additional variable from census data 2011, but I got the same error message as I got with the abs2011 data.

I'm currently using github installation of the package but got the same error message with r-cran version last week.

Thanks for help!
Onerva M.

Code below:

shapefile containing electoral boundaries from the

2013 federal election

sF_13 <- sF_download(year=2013)
trying URL 'https://github.com/ropenscilabs/eechidna/raw/master/extra-data/sF_13.rda'
Content type 'application/octet-stream' length 306828 bytes (299 KB)
downloaded 299 KB
data(abs2011)

load the centroids of 2011 SA1 polygons

load("centroids_sa1_2011.rda")

allocate electorate to allocate each SA1

to the electoral boundary in which it sits

mapping_c11_e13 <- allocate_electorate(centroids_ls = centroids_sa1_2011, electorates_sf = sF_13, census_year = "2011", election_year = "2013")
[1] 2000
[1] 4000
[1] 6000
[1] 8000
[1] 10000
[1] 12000
[1] 14000
[1] 16000
[1] 18000
[1] 20000
[1] 22000
[1] 24000
[1] 26000
[1] 28000
[1] 30000
[1] 32000
[1] 34000
[1] 36000
[1] 38000
[1] 40000
[1] 42000
[1] 44000
[1] 46000
[1] 48000
[1] 50000
[1] 52000
[1] 54000
There were 50 or more warnings (use warnings() to see the first 50)
warnings()
Warning messages:
1: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
2: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
3: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
4: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
5: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
6: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
7: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
8: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
9: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
10: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
11: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
12: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
13: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
14: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
15: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
16: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
17: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
18: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
19: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
20: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
21: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
22: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
23: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
24: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
25: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
26: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
27: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
28: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
29: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
30: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
31: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
32: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
33: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
34: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
35: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
36: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
37: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
38: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
39: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
40: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
41: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
42: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
43: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
44: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
45: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
46: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
47: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
48: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
49: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
50: In RGEOSBinPredFunc(spgeom1, spgeom2, byid, func) :
spgeom1 and spgeom2 have different proj4 strings
> census_aec13_11 <- weighted_avg_census_sa1(mapping_df = mapping_c11_e13, abs_df = abs2011)
Error: object 'CD' not found

Links broken on readme.md

On readme.md, the following is not true (in that there is no articles folder anymore):

We have many vignettes that show how to access these data in the package, and demonstrate how to analyse the data using R. These can be found in the articles tab at the top of this page.

And as such, the links are broken in this section.

Data from 2016 census to be added

I have the data for the 2016 Census collated. And R code to do this. These need to be added to the package, and then we can finish the paper.

2019 data

Over the summer holidays 'd like to pull in the 2019 election results to the project. Before I do so, is there anything I should know about best practices for this? The format should, I suppose be much like the 2016 results.

Vignettes not building

Vignettes are not building on Appveyor and Travis because of small changes made to data on the git repo. When there are other changes to warrant a new release these will be pushed through. No action required.

Error with eechidna::launchApp()

I just got an email from Natalia Da Silva who reported that this wasn't working.

With plotly 4.5.2 on my computer I get this error:

Error in get0(oNam, envir = ns) : 
  lazy-load database 'C:/emacs/R/win-library/3.3/shinyjs/R/shinyjs.rdb' is corrupt
In addition: Warning message:
In get0(oNam, envir = ns) : internal error -3 in R_decompress1

@cpsievert can you help?

My session info:

> devtools::session_info()
Session info ---------------------------------------------------------------------------
 setting  value                       
 version  R version 3.3.1 (2016-06-21)
 system   x86_64, mingw32             
 ui       RStudio (0.99.1280)         
 language (EN)                        
 collate  English_United States.1252  
 tz       America/Los_Angeles         
 date     2016-09-30                  

Packages -------------------------------------------------------------------------------
 package     * version date       source                                
 assertthat    0.1     2013-12-06 CRAN (R 3.2.0)                        
 base64enc     0.1-3   2015-07-28 CRAN (R 3.2.2)                        
 colorspace    1.2-6   2015-03-11 CRAN (R 3.2.4)                        
 curl          2.1     2016-09-22 CRAN (R 3.3.1)                        
 DBI           0.5-1   2016-09-10 CRAN (R 3.3.1)                        
 devtools      1.11.1  2016-04-21 CRAN (R 3.2.5)                        
 digest        0.6.10  2016-08-02 CRAN (R 3.3.1)                        
 dplyr         0.5.0   2016-06-24 CRAN (R 3.3.1)                        
 eechidna    * 0.1     2016-09-30 Github (ropenscilabs/eechidna@f8fd0d2)
 ggplot2       2.1.0   2016-03-01 CRAN (R 3.2.4)                        
 ggthemes      3.2.0   2016-07-11 CRAN (R 3.3.1)                        
 git2r         0.15.0  2016-05-11 CRAN (R 3.2.5)                        
 gridExtra     2.2.1   2016-02-29 CRAN (R 3.2.3)                        
 gtable        0.2.0   2016-02-26 CRAN (R 3.2.3)                        
 htmltools     0.3.5   2016-03-21 CRAN (R 3.2.4)                        
 htmlwidgets   0.7     2016-08-02 CRAN (R 3.3.1)                        
 httpuv        1.3.3   2015-08-04 CRAN (R 3.2.3)                        
 httr          1.2.1   2016-07-03 CRAN (R 3.3.1)                        
 jsonlite      1.1     2016-09-14 CRAN (R 3.3.1)                        
 knitr         1.14.4  2016-09-23 Github (yihui/knitr@54ea64f)          
 lazyeval      0.2.0   2016-06-12 CRAN (R 3.3.1)                        
 magrittr      1.5     2014-11-22 CRAN (R 3.2.0)                        
 memoise       1.0.0   2016-01-29 CRAN (R 3.2.4)                        
 mime          0.5     2016-07-07 CRAN (R 3.3.1)                        
 miniUI        0.1.1   2016-01-15 CRAN (R 3.2.5)                        
 munsell       0.4.3   2016-02-13 CRAN (R 3.2.3)                        
 plotly        4.5.2   2016-09-26 CRAN (R 3.3.1)                        
 plyr          1.8.4   2016-06-08 CRAN (R 3.3.1)                        
 R6            2.1.3   2016-08-19 CRAN (R 3.3.1)                        
 Rcpp          0.12.7  2016-09-05 CRAN (R 3.3.1)                        
 rsconnect     0.4.3   2016-05-02 CRAN (R 3.2.5)                        
 scales        0.4.0   2016-02-26 CRAN (R 3.2.3)                        
 shiny         0.14    2016-09-10 CRAN (R 3.3.1)                        
 shinyjs       0.7     2016-08-21 CRAN (R 3.3.1)                        
 tibble        1.2     2016-08-26 CRAN (R 3.3.1)                        
 tidyr         0.6.0   2016-08-12 CRAN (R 3.3.1)                        
 viridis       0.3.4   2016-03-12 CRAN (R 3.2.4)                        
 withr         1.0.1   2016-02-04 CRAN (R 3.2.4)                        
 xtable        1.8-2   2016-02-05 CRAN (R 3.2.4)                        
> 

URL in GitHub Repo incorrect

I noticed that the URL link on the GitHub repo returns a 404 error from ROpenSci.org, is that still the correct URL?

cartogram example code, creates 3 duplicated electorates

In the plot resulting from this code you can see three electorates, one in Vic and two in Australia, that are darker, there are two points overlaid suggesting an error in the data. This is fixed manually in the nat_data_cart.rda data provided with the package.

library(dplyr)
library(ggplot2)
data(nat_map)
data(nat_data)
cities <- list(c(151.2, -33.8), # Sydney
c(153.0, -27.5), # Brisbane
c(145.0, -37.8), # Melbourne
c(138.6, -34.9), # Adelaide,
c(115.9, -32.0)) # Perth
expand <- list(c(2,3.8), c(2,3), c(2.6,4.1), c(4,3), c(12,6))
nat_carto <- purrr::map2(.x=cities, .y=expand,
.f=aec_extract_f, aec_data=nat_data) %>%
purrr::map_df(aec_carto_f) %>%
mutate(region=as.integer(as.character(region))) %>%
rename(id=region)
nat_data_cart <- aec_carto_join_f(nat_data, nat_carto)

Map theme

theme_map <- theme_bw()
theme_map$line <- element_blank()
theme_map$strip.text <- element_blank()
theme_map$axis.text <- element_blank()
theme_map$plot.title <- element_blank()
theme_map$axis.title <- element_blank()
theme_map$panel.border <- element_rect(colour = "grey90", size=1, fill=NA)

ggplot(data=nat_map) +
geom_polygon(aes(x=long, y=lat, group=group, order=order),
fill="grey90", colour="white") +
geom_point(data=nat_data_cart, aes(x=x, y=y), size=2, alpha=0.4,
colour="#572d2c") +
geom_text(data=nat_data_cart, aes(x=x, y=y, label=id), size=0.5) +
coord_equal() + theme_map

color scheme for shiny app

1b9e77 "forest"

e7298a "pink"

e6ab02 "yellow"

66a61e "green"

7570b3 "violet"

d95f02 "orange"

3690c0 "blue"

More control to plot?

Hello all,

Thank you very much for the library, I think it is great and easy to use :)

Is it possible to add a bit more configuration to the plotting part? In particular I would like:

  • Add a border
  • Store the plot as a variable.

For now I'm using the eechidna:::dorling function to make Dorling Cratograms. (Maybe it is possible to do this already but I haven't found how to do it D:)

Cheers and thank you for your help,
Vanessa

Add arguments to launchApp()

  • Primary use would be for controlling the panels that display:
    • Some important ones: unemployment, median income, population, christianity
    • Important ages: 20-24, 85+

rmapshaper now on CRAN

@benmarwick Asked me to let you folks know when rmapshaper landed on CRAN. It was accepted and released this morning with version 0.1.0. Thanks for the nudge along, otherwise I probably wouldn't have done it by this point. :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.