Translate

Sunday, June 17, 2018

Colllapsible Trees

These are images of Collapsible Trees of LCDs, RJIs, by LCD, Precincts and Counties. Click to Enlarge.
See http://rmfmedia.com/public/viewhtml for URLs.
See also https://cran.r-project.org/web/packages/collapsibleTree/collapsibleTree.pdf
The 'hierarchy' argument defines the tree data in the code below the break.

No warranty for any data is expressed or implied. 
Please use at your own risk. Please understand all the laws that govern the use of WA Electoral Data: https://www.sos.wa.gov/elections/vrdb/vrdbfaq.aspx


# http://rmfmedia.com/public/viewhtml/viewhtml_WA_LCD_PCT
l2 = LCD_2018[ActiveVoters2018 > 5,.(LCD,ClintonStein_pct=round(ClintonStein/PresidentialVoters2016,2) * 100,
Clinton,Trump,
ClintonStein,
TrumpJohnson,
PresidentialVoters2016,
ActiveVoters2018,
PresVoters2016_div_ActiveVoters2018,
NoLastVote)]

l2 <- l2="" lintonstein_pct="" order="" p="">collapsibleTree(
  l2,
  hierarchy = c("ClintonStein_pct","LCD","ClintonStein","TrumpJohnson","PresidentialVoters2016"),
  root= "WA LCD",
  width=2000,
  height= 1600,
  zoomable = TRUE,
  collapsed = TRUE,
  tooltip = TRUE,
  attribute = "ActiveVoters2018",
  nodeSize= "count",
  aggFun = sum
)

# http://rmfmedia.com/public/viewhtml/viewhtml_WA_LCD_LCD
collapsibleTree(
  l2,
  hierarchy = c("LCD","ClintonStein_pct","ClintonStein","TrumpJohnson","PresidentialVoters2016"),
  root= "WA LCD",
  width=2000,
  height= 1600,
  zoomable = TRUE,
  collapsed = TRUE,
  tooltip = TRUE,
  attribute = "ActiveVoters2018",
  nodeSize= "count",
  aggFun = sum
)

# http://rmfmedia.com/public/viewhtml/viewhtml_LCD_Precincts
collapsibleTree(
  l2,
  hierarchy = c("LD","StateCode","Clinton","Trump","Stein","Johnson"),
  root= "WA LDs and Precincts",
  width=2000,
  height= 1600,
  zoomable = TRUE,
  collapsed = TRUE,
  tooltip = TRUE,
  attribute = "PresidentialVoters2016",
  nodeSize= "count",
  aggFun = sum
)

# http://rmfmedia.com/public/viewhtml/viewhtml_WA_2018Races_RJI
collapsibleTree(
  l2,
  hierarchy = c("CountyDisplay","RaceName","RJTN","RJN","NameParty"),
  root= "2018 WA RaceJurisdictionIDs,Races,Candidates,Parties",
  width=2000,
  height= 1600,
  zoomable = TRUE,
  collapsed = TRUE,
  tooltip = TRUE,
  attribute = "CountyDisplay",
  nodeSize= "leafCount",
  aggFun = length
)

No comments: