|
2 | 2 | title: "Spatial Data Handling"
|
3 | 3 | subtitle: "R Notes"
|
4 | 4 | author: "Luc Anselin and Grant Morrison^[University of Chicago, Center for Spatial Data Science -- [email protected],[email protected]]"
|
5 |
| -date: "08/07/2018" |
| 5 | +date: "latest update 09/03/2018" |
6 | 6 | output:
|
7 | 7 | html_document:
|
8 | 8 | fig_caption: yes
|
@@ -76,7 +76,7 @@ Below follows a list of the commands used in this notebook. For further details
|
76 | 76 | and a comprehensive list of options, please consult the
|
77 | 77 | [R documentation](https://www.rdocumentation.org).
|
78 | 78 |
|
79 |
| -- **base R**: `install.packages`, `library`, `head`, `dim`, `class`, `as.Date`, `names`, `!is.na`, `is.numeric`, `as.integer`, `is.integer`, `length`, `strsplit`, `unlist`, `for`, `vector`, `substr`, `gsub`, `as.numeric`, `data.frame` |
| 79 | +- **base R**: `setwd`, `install.packages`, `library`, `head`, `dim`, `class`, `as.Date`, `names`, `!is.na`, `is.numeric`, `as.integer`, `is.integer`, `length`, `strsplit`, `unlist`, `for`, `vector`, `substr`, `gsub`, `as.numeric`, `data.frame` |
80 | 80 |
|
81 | 81 | - **RSocrata**: `read.socrata`
|
82 | 82 |
|
@@ -145,8 +145,8 @@ we will have to deal with. We also check the dimension of this data frame using
|
145 | 145 | dim(vehicle.data)
|
146 | 146 | ```
|
147 | 147 |
|
148 |
| -The table has 200,657 observations on 26 variables (the number of observations |
149 |
| -may be different as the table is constantly updated). |
| 148 | +The table has 203,657 observations on 26 variables (the number of observations shown |
| 149 | +may be slightly different as the table is constantly updated). |
150 | 150 |
|
151 | 151 | In RStudio, the type of the variable in each column is listed under its name. For example, under **creation_date**, we see **S3: POSIXct**. You can also find out the same information by applying a `class` command to the variable
|
152 | 152 | **vehicle.data$creation_date**, as in
|
@@ -278,7 +278,7 @@ At this point, we will go about things in a slightly different way from how
|
278 | 278 | they are illustrated in the GeoDa workbook example. As it turns out, some of the points have missing community area information, which is a critical element to compute the number of abandoned cars at that scale. In GeoDa, we used a visual approach to obtain the missing information. Here, we will exploit some of the GIS functionality in **sf** to carry out a **spatial join**. This boils down to identifying which points belong to each community area (a so-called *point in polygon query*) and assigning the corresponding community area identifier to each point.
|
279 | 279 |
|
280 | 280 | We proceed in three steps. First, we create a simple features spatial polygon object with the boundaries of the community areas, which we download from the Chicago Open Data portal. Next,
|
281 |
| -we carry out a spatial join between our points object and the polygon object to assing a community area code to each point. Finally, we compute the point count by community area. |
| 281 | +we carry out a spatial join between our points object and the polygon object to assign a community area code to each point. Finally, we compute the point count by community area. |
282 | 282 |
|
283 | 283 | ### Community Area boundary file {-}
|
284 | 284 | We resort to the City of Chicago open data portal for the boundary file of
|
|
0 commit comments