Skip to content

Commit 1218f6f

Browse files
author
fiddlesleet
authored
Add files via upload
1 parent a665d57 commit 1218f6f

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed
113 KB
Loading
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# NOTE: "A choropleth is any map that shows borders (such as states),
2+
# and expresses values for the regions with color"
3+
4+
# install and load the packages
5+
library(choroplethr)
6+
library(choroplethrAdmin1)
7+
library(acs)
8+
library(gridExtra)
9+
library(microbenchmark)
10+
11+
install.packages('choroplethrAdmin1')
12+
### read in data
13+
14+
# map of continental us + southern canada
15+
data("continental_us_states")
16+
lower_canada <- c("british columbia", "alberta", "saskatchewan", "manitoba",
17+
"ontario", "quebec")
18+
regions <- c(lower_canada, continental_us_states)
19+
df <- data.frame(region=regions, value=sample(1:length(regions)))
20+
map1 <- admin1_region_choropleth(df, title = "The U.S. & Southern Canada")
21+
map2 <- admin1_region_choropleth(df, num_colors = 7, reference_map = TRUE)
22+
grid.arrange(map1, map2, nrow = 1)
23+
24+
25+
## state population data
26+
# choroplethr data
27+
data(df_pop_state)
28+
tail(df_pop_state)
29+
data(df_county_demographics)
30+
67.8 KB
Loading

0 commit comments

Comments
 (0)