-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.Rhistory
185 lines (185 loc) · 5.34 KB
/
.Rhistory
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
x <- c("ggmap", "rgdal", "rgeos", "maptools", "dplyr", "tidyr", "tmap")
lapply(x, library, character.only = TRUE)
lapply(x, library, character.only = TRUE)
lapply(x, library, character.only = TRUE)
library(rgdal)
lnd <- readOGR(dsn = "mexstates", layer = "mexstates")
plot(lnd)
head(lnd@data)
plot(lnd)
head(lnd)
library(rgdal)
library(rgdal)
head(lnd)
head(lnd@data)
ln
lnd@data
gCentroid
x <- c("ggmap", "rgdal", "rgeos", "maptools", "dplyr", "tidyr", "tmap")
lapply(x, library, character.only = TRUE)
lapply(x, library, character.only = TRUE)
gCentroid(lnd)
plot(gCentroid(lnd))
plot(lnd)
points(gCentroid(lnd))
points(gCentroid(lnd) col = "blue")
points(gCentroid(lnd) col = "blue")
plot(lnd)
gCentroid(lnd)
library(rgeos)
library(rgeos)
gCentroid(lnd)
plot(gCentroid(lnd))
gCentroid(lnd)
plot(lnd)
points(gCentroid(lnd))
?points
points(gCentroid(lnd), col = "red")
points(gCentroid(lnd), col = "blue")
library(rgeos)
library(rgeos)
grep("London", lnd$name)
head(lnd)
head(lnd@data)
grep("Distrito", lnd$ADMIN_NAME)
lnd@data[grep("Distrito", lnd$ADMIN_NAME), ]
plot(lnd@data[grep("Distrito", lnd$ADMIN_NAME), ])
plot(lnd[grep("Distrito", lnd$ADMIN_NAME), ])
df <- lnd[grep("Distrito", lnd$ADMIN_NAME), ]
plot(df)
plot(lnd)
points(gCentroid(df))
points(gCentroid(df), col= "red")
points(gCentroid(df), col= "yellow")
points(gCentroid(df), col= "yellow", pch = 20)
library(rgeos)
library(rgeos)
nearDF <- gDistance(gCentroid(df), gCentroid(lnd, byid = TRUE), byid = TRUE) < 600
gDistance(gCentroid(df), gCentroid(lnd, byid = TRUE), byid = TRUE)
plot(nearDF)
plot(lnd)
points(nearDF)
points(nearDF)
plot(lnd)
points(nearDF)
nearLondon <- gDistance(gCentroid(lnd[grep("Distrito", lnd$ADMIN_NAME) , ]), gCentroid(lnd, byid = TRUE), byid = TRUE) < 10000
nearLondon <- gDistance(gCentroid(lnd[grep("Distrito", lnd$ADMIN_NAME) , ]), gCentroid(lnd, byid = TRUE), byid = TRUE) < 10
nearDF <- gDistance(gCentroid(df), gCentroid(lnd, byid = TRUE), byid = TRUE) < 10
nearDF
nearLondon <- NULL
plot(lnd)
points(lnd[nearDF, ])
plot(lnd[nearDF, ])
plot(lnd@data[nearDF, ])
plot(lnd@polygons[nearDF, ])
plot(lnd@polygons[nearDF, ])
plot(lnd[nearDF, ])
library(rgeos)
library(rgeos)
plot(lnd[ nearDF, ], add = TRUE)
library(rgeos)
library(rgeos)
lnd@data[nearDF, ]
lnd@data[nearDF, c(4,8,11)]
nearDF <- gDistance(gCentroid(df), gCentroid(lnd, byid = TRUE), byid = TRUE) < 6
lnd@data[nearDF, c(4,8,11)]
plot(lnd)
plot(lnd@data[nearDF, c(4,8,11)])
plot(lnd[nearDF, c(4,8,11)])
plot(lnd[nearDF,])
test <- lnd[nearDF,]
?plot
estadosCerca <- lnd[nearDF,]
estadosCerca <- lnd[nearDF,]
library(rgeos)
library(rgeos)
estadosCerca <- lnd[nearDF,]
lnd[nearDF,]
nearDF
nearDF <- lnd[gDistance(gCentroid(df), gCentroid(lnd, byid = TRUE), byid = TRUE) < 6, ]
nearDF <- lnd[gDistance(gCentroid(df), gCentroid(lnd, byid = TRUE), byid = TRUE) < 6, ]
nearDF <- lnd[gDistance(gCentroid(df), gCentroid(lnd, byid = TRUE), byid = TRUE) < 6, ]
nearDF
nearDF <- lnd[gDistance(gCentroid(df), gCentroid(lnd, byid = TRUE), byid = TRUE) < 6, ]
nearDF <- lnd[gDistance(gCentroid(df), gCentroid(lnd, byid = TRUE), byid = TRUE) < 6, ]
df
nearDF <- lnd[lnd$OBJECTID == (gDistance(gCentroid(df), gCentroid(lnd, byid = TRUE), byid = TRUE) < 6), ]
lnd@data[lnd$OBJECTID == nearDF,]
lnd@data[lnd$OBJECTID == nearDF$OBJECTID,]
lnd@data[lnd == nearDF,]
lnd@data[lnd = nearDF,]
lnd@data[nearDF,]
lnd@data[nearDF,]
lnd[nearDF,]
lnd@data[nearDF,]
lnd@data[nearDF,]
lnd@[nearDF,]
lnd[nearDF,]
lnd[lnd@data[nearDF,],]
lnd@data[nearDF,]
estados <- lnd@data[nearDF,]
plot(estados)
plot(lnd[estados,])
estados
estados <- lnd[nearDF,]
plot(lnd[nearDF,])
rm(nearLondon)
nearDF <- lnd[gDistance(gCentroid(df), gCentroid(lnd, byid = TRUE), byid = TRUE) < 6, ]
nearDF <- lnd[gDistance(gCentroid(df), gCentroid(lnd, byid = TRUE), byid = TRUE) < 6, ]
nearDF <- lnd[gDistance(gCentroid(df), gCentroid(lnd, byid = TRUE), byid = TRUE) < 6, ]
nearDF <- lnd[(gDistance(gCentroid(df), gCentroid(lnd, byid = TRUE), byid = TRUE) < 6), ]
distance <- gDistance(gCentroid(df), gCentroid(lnd, byid = TRUE), byid = TRUE) < 6
rm(estados)
nearDF <- lnd[distance, ]
lnd[distance, ]
lnd@data[distance, ]
library(rgeos)
lapply(x, library, character.only = TRUE)
lapply(x, library, character.only = TRUE)
nearDF <- lnd[distance, ]
?subset
rm(distance)
lnd@data[distance, ]
lnd@data[nearDF, ]
lnd[lnd@data[nearDF, ]]
te <- lnd@data[nearDF, ]
lnd[te,]
lnd[te,return=TRUE]
lnd[te]
lnd[te]
lnd[]
lnd[nearDF]
lnd[nearDF,]
lnd[nearDF, 1]
lnd[nearDF]
te
rm(te)
df
estados <- lnd[gDistance(gCentroid(df), gCentroid(lnd, byid = TRUE), byid = TRUE),]
estados <- lnd[gDistance(gCentroid(df), gCentroid(lnd, byid = TRUE), byid = TRUE) > 6,]
estados <- lnd[gDistance(gCentroid(lnd), gCentroid(lnd, byid = TRUE), byid = TRUE) > 6,]
estados <- lnd[gDistance(gCentroid(lnd@polygons), gCentroid(lnd@polygons, byid = TRUE), byid = TRUE) > 6,]
estados <- lnd[gDistance(gCentroid(df), gCentroid(lnd, byid = TRUE), byid = TRUE) > 6,]
lapply(x, library, character.only = TRUE)
lapply(x, library, character.only = TRUE)
lnd[nearDF,]
plot(lnd)
str(nearDF)
lnd@data[nearDF,]
lnd[nearDF,]
lnd[c(nearDF),]
plot(lnd[c(nearDF),])
plot(lnd)
lines(lnd[c(nearDF),], col = "blue")
points(lnd[c(nearDF),], col = "blue")
lnd[c(nearDF),]
nearStates <- lnd[c(nearDF),]
plot(nearStates)
plot(lnd)
lines(nearStates, col = "blue")
points(nearStates, col = "blue")
points(nearStates)
plot(lnd, add = TRUE)
plot(nearStates, add = TRUE)
plot(nearStates, add = TRUE, col="blue")
lnd@data[nearDF, 4]