Skip to content

Commit 3fe641f

Browse files
committed
updating code
1 parent b2f70a5 commit 3fe641f

File tree

123 files changed

+15306
-5344
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+15306
-5344
lines changed

01_georeference.Rmd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,4 @@ You can save a map as an interactive HTML page or a static `.png, .pdf, or .jpeg
6969
- `mapshot(starNCmap, url = "map.html")`
7070

7171

72+

01_ggmap_georef.Rmd

Lines changed: 0 additions & 116 deletions
This file was deleted.

02_choropleth.Rmd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ starbucksNC <- st_as_sf(starbucksNC, coords = c("Longitude", "Latitude"), crs =
8888
Generate the map with multiple layers. You can read more about additional arguments such as `homebutton, legend, alpha, cex` in the [`mapview()` documentation](https://r-spatial.github.io/mapview/reference/mapView.html). Read about the many more mapview functions in the [full documentation](https://r-spatial.github.io/mapview/reference/).
8989

9090
```{r}
91+
library(leafem)
9192
mymap <- mapview(nc_pop,
9293
zcol = "estimate",
9394
homebutton = FALSE) +

031_thematic_mapping.Rmd

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ us_geo <- tigris::states(class = "sf")
2424

2525
```{r get-data, message=FALSE, warning=FALSE, include=FALSE, paged.print=FALSE}
2626
us_geo <- tigris::states(class = "sf")
27-
# us_geo_spdf <- states() # spdf uses @data slots -- old school
2827
```
2928

3029
## Data Structure
@@ -110,18 +109,16 @@ BlsWage_ToJoin <- Salary4Helpers %>%
110109
```
111110

112111

113-
## Append data
112+
## Join data
114113

115-
Using the `append_data()` function of the `tmaptools` package, append BLS data to the previously loaded shape object
114+
Use the `dplyr::left_join()` function or the base-R `merge()` function to append BLS data to the previously loaded shape object
116115

117116
```{r make_nice_df, message=FALSE, warning=FALSE}
118-
HelperShapeObject <- append_data(us_geo, BlsWage_ToJoin,
119-
key.shp = "NAME",
120-
key.data = "State")
117+
HelperShapeObject <- left_join(us_geo, BlsWage_ToJoin, by = c("NAME" = "State"))
118+
121119
as_tibble(HelperShapeObject)
122120
```
123121

124-
125122
## Quick Thematic Map
126123

127124
```{r make_qtm}
@@ -135,10 +132,10 @@ Filter to only the contiguous 48 states + D.C.
135132

136133
```{r subset-data}
137134
contiguous_states <- HelperShapeObject %>%
138-
filter(REGION != 9) %>%
135+
filter(REGION != 9) %>%
139136
filter(STUSPS != "AK") %>%
140137
filter(STUSPS != "HI")
141-
138+
142139
```
143140

144141

@@ -177,10 +174,10 @@ tm_shape(contiguous_states, projection = 5070) +
177174
tm_shape(contiguous_states, projection = 5070) +
178175
tm_borders(col = "black", alpha = 0.4) +
179176
tm_fill(col = "REGION", alpha = 0.6) +
180-
tm_style_beaver(title = "Regions of the USA",
177+
tm_layout(title = "Regions of the USA",
181178
attr.color = "navy",
182179
title.position = c("center", "top"),
183-
title.bg.color = "yellow")
180+
title.bg.color = "lightblue")
184181
```
185182

186183

036_thematic_mapping-outputs-fullwebpage.Rmd

Lines changed: 0 additions & 65 deletions
This file was deleted.

0 commit comments

Comments
 (0)