Skip to content

Commit

Permalink
replaces length with count
Browse files Browse the repository at this point in the history
  • Loading branch information
Nowosad committed Oct 9, 2023
1 parent c703759 commit dadf375
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions 06-raster-vector.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -361,11 +361,11 @@ ch_raster1 = rasterize(cycle_hire_osm_projected, raster_template)
```

The `fun` argument specifies summary statistics used to convert multiple observations in close proximity into associate cells in the raster object.
By default `fun = "last"` is used but other options such as `fun = "length"` can be used, in this case to count the number of cycle hire points in each grid cell (the results of this operation are illustrated in Figure \@ref(fig:vector-rasterization1)(C)).
By default `fun = "last"` is used but other options such as `fun = "count"` can be used, in this case to count the number of cycle hire points in each grid cell (the results of this operation are illustrated in Figure \@ref(fig:vector-rasterization1)(C)).

```{r 06-raster-vector-26}
ch_raster2 = rasterize(cycle_hire_osm_projected, raster_template,
fun = "length")
fun = "count")
```

The new output, `ch_raster2`, shows the number of cycle hire points in each grid cell.
Expand Down
2 changes: 1 addition & 1 deletion _06-ex.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ plot(st_geometry(nz_height3100), graticule = new_graticule, axes = TRUE)
nz_template = rast(ext(nz_height3100), resolution = 3000, crs = crs(nz_height3100))
nz_raster = rasterize(nz_height3100, nz_template,
field = "elevation", fun = "length")
field = "elevation", fun = "count")
plot(nz_raster)
plot(st_geometry(nz_height3100), add = TRUE)
Expand Down

0 comments on commit dadf375

Please sign in to comment.