forked from spatialanalysis/workshop-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweek4-fall2019-workshop.R
53 lines (39 loc) · 1008 Bytes
/
week4-fall2019-workshop.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# install_github("spatialanalysis/geodaData")
library(geodaData)
library(sf)
library(tmap)
head(nyc_sf)
dim(nyc_sf)
str(nyc_sf)
plot(nyc_sf) # all attributes
names(nyc_sf)
plot(nyc_sf["geometry"]) # just outlines
summary(nyc_sf)
?nyc_sf
st_crs(nyc_sf)
tm_shape(nyc_sf) +
tm_polygons() +
tm_shape(st_centroid(nyc_sf)) +
tm_dots(size = 0.5)
tm_shape(nyc_sf) +
tm_polygons("rent2008")
tm_shape(nyc_sf) +
tm_fill("rent2008") +
tm_borders()
tmap_mode("view")
tm_shape(nyc_sf) +
tm_polygons("rent2008") +
tm_basemap(server = "OpenStreetMap")
tmap_mode("plot")
leaflet::providers
?tm_polygons
tm_shape(nyc_sf) +
tm_fill("rent2008", title = "Rent in 2008", legend.hist = TRUE) +
tm_borders() +
tm_layout(main.title = "Rent in NYC Boroughs, 2008", compass.type = "4star", legend.outside = TRUE) +
tm_compass() +
tm_scale_bar(position = c("left", "top"))
tm_shape(nyc_sf) +
tm_fill("rent2008", title = "Rent in 2008", legend.hist = TRUE) +
tm_borders() +
tm_style_cobalt()