Skip to content

Commit 114fb2a

Browse files
committed
Update files
1 parent 1b901a4 commit 114fb2a

2 files changed

Lines changed: 39 additions & 31 deletions

File tree

course-info/2017-03-31-spatial-data-lnd.Rmd

Lines changed: 39 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -118,52 +118,60 @@ The main document to accompany this tutorial is a [pdf](https://github.com/Robin
118118
u = "https://github.com/Robinlovelace/Creating-maps-in-R/archive/master.zip"
119119
download.file(u, "master.zip")
120120
unzip("master.zip")
121-
```
122121
123-
- Open the `.Rproj` file in the resulting folder
124122
125-
## Example: stations in central London
126123
127-
```{r, eval=FALSE}
128-
library(rgdal)
129-
lnd = readOGR("data/london_sport.shp")
130-
```
131124
132-
## sf - code for reading world dataset
133125
134-
```{r, eval=FALSE}
135-
install.packages("devtools") # if not already installed
136-
devtools::install_github("nowosad/spData")
137-
library(dplyr)
138-
lnd@data %>%
139-
filter(grepl("s", name)) %>%
140-
arrange(Partic_Per)
141126
142-
```
143127
144-
## Accessing data
145128
146-
```{r, eval=FALSE}
147-
install.packages("rnaturalearth")
148-
countries = rnaturalearth::countries110
149-
plot(countries)
129+
130+
131+
132+
150133
```
151134

152-
## Routing
135+
- Open the `.Rproj` file in the resulting folder
153136

154-
```{r, eval=FALSE}
155-
library(stplanr)
156-
r = route_cyclestreet(from = "Senate House, London", to = "Leeds")
157-
qtm(r)
158-
rg = route_graphhopper(from = "Senate House, London", "London King's cross")
159-
rg = route_graphhopper(from = "Senate House, London", "London King's cross")
160-
rc = route_graphhopper(from = "Senate House, London", "London King's cross", vehicle = "car")
161-
qtm(rg)+
162-
qtm(rc, lines.col = "green")
137+
```{r}
138+
# use Ctrl-Enter
139+
x = 1:5
140+
y = x^2
141+
plot(x, y)
142+
143+
library(sp)
144+
library(rgdal)
145+
lnd = readOGR("data/london_sport.shp")
146+
names(lnd)
147+
lnd$quadrant = "unknown"
148+
149+
plot(lnd)
150+
llgridlines(obj = lnd)
151+
152+
load("data/stations.RData")
153+
154+
points(stations)
155+
lnd_zone = lnd[5,]
156+
plot(lnd_zone)
157+
stations_in_zone =
158+
stations[lnd_zone,]
159+
points(stations_in_zone, col = "red" )
160+
library(tmap)
161+
tmap_mode("view")
162+
qtm(lnd)
163+
library(dplyr)
164+
lnd@data %>%
165+
filter(Partic_Per > 25)
163166
```
164167

165168

169+
## Example: stations in central London
166170

171+
```{r, eval=FALSE}
172+
library(rgdal)
173+
lnd = readOGR("data/london_sport.shp")
174+
```
167175

168176

169177

data/lnd84.Rds

-1 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)