You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _posts/2016-12-11-r-geojson-srt.md
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -56,7 +56,7 @@ The first thing you can do is plot the data, and the `plot` command makes that e
56
56
plot(data_json)
57
57
{% endhighlight %}
58
58
59
-

59
+

60
60
61
61
Unfortunately, this plot is not very helpful because it simply plots the points without any context. So we use the `ggmap` and `ggplot2` package to give us some context. First, we download from Google the right map.
62
62
@@ -87,7 +87,7 @@ Now we can make the plot:
87
87
print(mapImage + geom_point(aes(lon, lat), data = data_df))
88
88
{% endhighlight %}
89
89
90
-

90
+

91
91
92
92
It may be helpful to add labels based on the name of the location, given in the 'title' field:
93
93
@@ -97,7 +97,7 @@ mapImage + geom_point(aes(lon, lat), data = data_df) + geom_text(aes(lon, lat,
Copy file name to clipboardExpand all lines: _posts/2016-12-16-r-geojson-gardens.md
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,7 @@ First, we plot the data as before:
51
51
plot(data_park)
52
52
{% endhighlight %}
53
53
54
-

54
+

55
55
56
56
While this was easy to do, it doesn't give very much context. However, it does give the boundaries of the different parks. As before, we use the `ggmap` and `ggplot2` package to give us some context. First, we download from Google the right map.
57
57
@@ -80,7 +80,7 @@ print(mapImage + geom_polygon(aes(long, lat, group = group), data = data_park_df
80
80
colour = "green"))
81
81
{% endhighlight %}
82
82
83
-

83
+

84
84
85
85
Note the use of the `group=` option in the `geom_polygon` function above. This tells `geom_polygon` that there are many polygons rather than just one. Without that option, you get a big mess:
86
86
@@ -89,7 +89,7 @@ Note the use of the `group=` option in the `geom_polygon` function above. This t
89
89
print(mapImage + geom_polygon(aes(long, lat), data = data_park_df, colour = "green"))
90
90
{% endhighlight %}
91
91
92
-

92
+

93
93
94
94
## Mashup of parking convenient to Swamp Rabbit Trail and city parks
95
95
@@ -99,7 +99,7 @@ Now, say you want to combine the city parks data with the parking places conveni
99
99
100
100
Next, we use the layering feature of `ggplot2` to draw the map:
101
101
102
-

102
+


267
+

268
268
269
269
Then we can do this analysis within each speech to find out what distinguishes them from other speeches. The `for` loop below can be used to print multiple pages of faceted graphs, good for when you are using RStudio or the R gui to explore.
270
270
@@ -290,7 +290,7 @@ for (i in 1:floor(length(speakers_vec)/n_panel)) {
290
290
}
291
291
{% endhighlight %}
292
292
293
-

293
+


318
+

319
319
320
320
It's pretty interesting that Speech 26 is unlike nearly all the others. This was William Henry Harrison discussing something about the Roman aristocracy, something other presidents have not felt the need to do very much.
321
321
@@ -348,13 +348,13 @@ for (i in 1:length(inaug_km$withinss)) {
348
348
349
349
{% highlight text %}
350
350
## [1] Cluster 1
351
-
## [1]government people citizens time country nation
352
-
## [7]own <NA> <NA> <NA> <NA> <NA>
351
+
## [1] people government country owncitizens time
352
+
## [7]nation <NA> <NA> <NA> <NA> <NA>
353
353
## [13] <NA> <NA> <NA> <NA> <NA> <NA>
354
354
## [19] <NA> <NA>
355
355
## [1] Cluster 2
356
-
## [1] government people citizens countryown nation
357
-
## [7]time <NA> <NA> <NA> <NA> <NA>
356
+
## [1] government people citizens timecountry nation
357
+
## [7]own <NA> <NA> <NA> <NA> <NA>
358
358
## [13] <NA> <NA> <NA> <NA> <NA> <NA>
359
359
## [19] <NA> <NA>
360
360
## [1] Cluster 3
@@ -368,16 +368,16 @@ for (i in 1:length(inaug_km$withinss)) {
368
368
## [13] <NA> <NA> <NA> <NA> <NA> <NA>
369
369
## [19] <NA> <NA>
370
370
## [1] Cluster 5
371
-
## [1] people government country own citizens time
372
-
## [7]nation <NA> <NA> <NA> <NA> <NA>
371
+
## [1]government people citizens country own nation
0 commit comments