diff --git a/README.Rmd b/README.Rmd index c5830e3..5c32af1 100644 --- a/README.Rmd +++ b/README.Rmd @@ -22,16 +22,14 @@ knitr::opts_chunk$set( # tabularaster -The `raster` package is extremely powerful in the R ecosystem for spatial data. It can be used very efficiently to -drive data extraction and summary tools using its consistent cell-index and comprehensive helper functions for converting between cell values and less abstract raster grid properties. +The `raster` package is extremely powerful for spatial data. It provides very efficient data extraction and summary tools via consistent cell-index and comprehensive set of functions for working with grids, cells and their values. -Tabularaster provides some more helpers for working with cells and tries to fill some of the (very few!) gaps in raster functionality. When raster returns cell values of hierarchical objects it returns a hierarchical (list) of cells to match the input query. +Tabularaster provides some more helpers for working with cells and tries to fill some of the (very few!) gaps in raster functionality. When raster returns cell values of hierarchical objects it returns a hierarchical (list) of cells to match the input query, while `tabularaster::cellnumbers` instead returns a data frame of identifiers and cell numbers. -Tabularaster provides on a few simple functions. +Tabularaster provides these functions. * `as_tibble` - convert to data frame with options for value column and cell, dimension and date indexing * `cellnumbers` - extract of cell index numbers as a simple data frame with "object ID" and "cell index" -* `extentFromCells` - create an extent from cell index numbers * `index_extent` - create an index extent, essentially `extent(0, ncol(raster), 0, nrow(raster))` All functions that work with `sp Spatial` also work with `sf simple features. @@ -40,12 +38,18 @@ There is some overlap with `quadmesh` and `spex` while I figure out where things # Installation -Install from CRAN, or get the development version from Github. +Install from CRAN, + ```{r, eval=FALSE} -devtools::install_github("hypertidy/tabularaster") +install.packages("tabularaster") ``` +or get the development version from Github. + +```{r, eval=FALSE} +devtools::install_github("hypertidy/tabularaster") +``` # Usage diff --git a/README.md b/README.md index 0d44ec7..583d796 100644 --- a/README.md +++ b/README.md @@ -13,24 +13,24 @@ downloads](http://cranlogs.r-pkg.org/badges/tabularaster)](http://www.r-pkg.org/ # tabularaster -The `raster` package is extremely powerful in the R ecosystem for -spatial data. It can be used very efficiently to drive data extraction -and summary tools using its consistent cell-index and comprehensive -helper functions for converting between cell values and less abstract -raster grid properties. +The `raster` package is extremely powerful for spatial data. It provides +very efficient data extraction and summary tools via consistent +cell-index and comprehensive set of functions for working with grids, +cells and their values. Tabularaster provides some more helpers for working with cells and tries to fill some of the (very few\!) gaps in raster functionality. When raster returns cell values of hierarchical objects it returns a -hierarchical (list) of cells to match the input query. +hierarchical (list) of cells to match the input query, while +`tabularaster::cellnumbers` instead returns a data frame of identifiers +and cell numbers. -Tabularaster provides on a few simple functions. +Tabularaster provides these functions. - `as_tibble` - convert to data frame with options for value column and cell, dimension and date indexing - `cellnumbers` - extract of cell index numbers as a simple data frame with “object ID” and “cell index” - - `extentFromCells` - create an extent from cell index numbers - `index_extent` - create an index extent, essentially `extent(0, ncol(raster), 0, nrow(raster))` @@ -42,7 +42,13 @@ where things belong. # Installation -Install from CRAN, or get the development version from Github. +Install from CRAN, + +``` r +install.packages("tabularaster") +``` + +or get the development version from Github. ``` r devtools::install_github("hypertidy/tabularaster") diff --git a/docs/articles/cell-index-raster-abstraction.html b/docs/articles/cell-index-raster-abstraction.html index 1a1e4d1..e6f3e28 100644 --- a/docs/articles/cell-index-raster-abstraction.html +++ b/docs/articles/cell-index-raster-abstraction.html @@ -8,14 +8,17 @@ The raster functions for cell abstraction • tabularaster - - + + + + -
+
-
+
+

2018-05-22

+ + Source: vignettes/cell-index-raster-abstraction.Rmd + + +
-

The following functions in the raster package are designed to work with cell indexes.

fun(r, cell)

    @@ -116,7 +130,6 @@

    2017-08-05

The sparse raster is a under-used feature and needs to be fleshed out.

-
-

Site built with pkgdown.

+

Site built with pkgdown.

+ + diff --git a/docs/articles/index.html b/docs/articles/index.html index 0713982..107b921 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -18,13 +18,19 @@ + + - - + + + + + + @@ -37,7 +43,7 @@ -
+
@@ -93,19 +106,18 @@ - -
-
+
+ + @@ -118,11 +130,14 @@

All vignettes

-

Site built with pkgdown.

+

Site built with pkgdown.

+ + + diff --git a/docs/articles/tabularaster-usage.html b/docs/articles/tabularaster-usage.html index c6904a2..9e4dfff 100644 --- a/docs/articles/tabularaster-usage.html +++ b/docs/articles/tabularaster-usage.html @@ -8,14 +8,17 @@ Tabularaster • tabularaster - - + + + + -
+
-
+
+

2018-05-22

+ + Source: vignettes/tabularaster-usage.Rmd + + +
-

tabularaster

@@ -94,7 +108,7 @@

Extract the cell numbers of raster r that are co-located with object q. (The argument names are x and query).

- +

In the above example, r is any raster object and q is another spatial object, used as a query. Cell numbers can be extracted from any raster object, any of a raster::raster, raster::stack or raster::brick. It’s not really relevant what that object contains, as only the dimensions (number of cells in x and y) and the extent (geographic range in x and y) determine the result. The r object can actually not contain any data - this is a very powerful but seemingly under-used feature of the raster package.

The object q may be any of sf, sp layer types or a matrix of raw coordinates (x-y). (‘Exotic’ sf types like GEOMETRYCOLLECTION or POLYHEDRALSURFACE, and mixed-topology layers are not yet supported - let me know if you really need this and we’ll make it work.)

Tabularaster follows the basic principles of tidy data and hypertidy data and aspires to keep the software design out of your way and simply help to get the task done.

@@ -103,10 +117,10 @@

Simple examples

In straightforward usage, cellnumbers returns a tibble with object_ to identify the spatial object by number, and cell_ which is specific to the raster object, a function of its extent, dimensions and projection (crs - coordinate reference system).

-
library(raster)
+
## Loading required package: sp
-
library(tabularaster)
-(r <- raster(volcano))
+
## class       : RasterLayer 
 ## dimensions  : 87, 61, 5307  (nrow, ncol, ncell)
 ## resolution  : 0.01639344, 0.01149425  (x, y)
@@ -115,7 +129,7 @@ 

## data source : in memory ## names : layer ## values : 94, 195 (min, max)

-
(cell <- cellnumbers(r, cbind(0.5, 0.5)))
+
## Warning: projections not the same 
 ##     x: NA
 ## query: NA
@@ -124,10 +138,10 @@

## <int> <dbl> ## 1 1 2654

This cell number query can be then be used to drive other raster functions, like extract and xyFromCell and many others.

-
xyFromCell(r, cell$cell_)
+
xyFromCell(r, cell$cell_)
##        x   y
 ## [1,] 0.5 0.5
-
raster::extract(r, cell$cell_)
+
raster::extract(r, cell$cell_)
##     
 ## 161

This is an extremely efficient way to drive extractions from raster objects, for performing the same query from multiple layers at different times. It’s also very useful for using dplyr to derive summaries, rather than juggling lists of extracted values, or different parts of raster objects.

@@ -135,7 +149,7 @@

as tibble

There is an as_tibble method with options for cell, dimension, and date.

-
library(dplyr)
+
## 
 ## Attaching package: 'dplyr'
## The following objects are masked from 'package:raster':
@@ -147,7 +161,7 @@ 

## The following objects are masked from 'package:base':
 ## 
 ##     intersect, setdiff, setequal, union
- +
## # A tibble: 5,307 x 2
 ##    cellvalue cellindex
 ##        <dbl>     <int>
@@ -162,8 +176,8 @@ 

## 9 100 9 ## 10 100 10 ## # ... with 5,297 more rows

-
b <- brick(r, r*2)
-as_tibble(b)
+
b <- brick(r, r*2)
+as_tibble(b)
## # A tibble: 10,614 x 3
 ##    cellvalue cellindex dimindex
 ##        <dbl>     <int>    <int>
@@ -178,7 +192,7 @@ 

## 9 100 9 1 ## 10 100 10 1 ## # ... with 10,604 more rows

-
as_tibble(b, cell = FALSE) %>% arrange(desc(dimindex)) ## leave out the cell index
+
as_tibble(b, cell = FALSE) %>% arrange(desc(dimindex)) ## leave out the cell index
## # A tibble: 10,614 x 2
 ##    cellvalue dimindex
 ##        <dbl>    <int>
@@ -194,27 +208,27 @@ 

## 10 200 2 ## # ... with 10,604 more rows

The date or date-time is used as the dimension index if present.

-
btime <- setZ(b, Sys.time() + c(1, 10))
-as_tibble(btime) %>% group_by(dimindex) %>% summarize(n = n())
+
btime <- setZ(b, Sys.time() + c(1, 10))
+as_tibble(btime) %>% group_by(dimindex) %>% summarize(n = n())
## # A tibble: 2 x 2
-##              dimindex     n
-##                <dttm> <int>
-## 1 2017-08-05 14:16:21  5307
-## 2 2017-08-05 14:16:30  5307
-
as_tibble(btime, split_date = TRUE)
+## dimindex n +## <dttm> <int> +## 1 2018-05-22 05:53:52 5307 +## 2 2018-05-22 05:54:01 5307

+
as_tibble(btime, split_date = TRUE)
## # A tibble: 10,614 x 5
 ##    cellvalue cellindex  year month   day
 ##        <dbl>     <int> <int> <int> <int>
-##  1       100         1  2017     8     5
-##  2       100         2  2017     8     5
-##  3       101         3  2017     8     5
-##  4       101         4  2017     8     5
-##  5       101         5  2017     8     5
-##  6       101         6  2017     8     5
-##  7       101         7  2017     8     5
-##  8       100         8  2017     8     5
-##  9       100         9  2017     8     5
-## 10       100        10  2017     8     5
+##  1       100         1  2018     5    22
+##  2       100         2  2018     5    22
+##  3       101         3  2018     5    22
+##  4       101         4  2018     5    22
+##  5       101         5  2018     5    22
+##  6       101         6  2018     5    22
+##  7       101         7  2018     5    22
+##  8       100         8  2018     5    22
+##  9       100         9  2018     5    22
+## 10       100        10  2018     5    22
 ## # ... with 10,604 more rows
@@ -236,26 +250,28 @@

Applied example

This example uses extracted data per polygon and uses base R to lapply across the list of values extracted per polygon. Here we show a more dplyrish version after extracting the cell numbers with tabularaster.

-
library(tabularaster)
-## https://gis.stackexchange.com/questions/102870/step-by-step-how-do-i-extract-raster-values-from-polygon-overlay-with-q-gis-or
-
-library(raster)
-
-# Create integer class raster
-r <- raster(ncol=36, nrow=18)
-r[] <- round(runif(ncell(r),1,10),digits=0)
-
-# Create two polygons
-cds1 <- rbind(c(-180,-20), c(-160,5), c(-60, 0), c(-160,-60), c(-180,-20))
-cds2 <- rbind(c(80,0), c(100,60), c(120,0), c(120,-55), c(80,0))
-polys <- SpatialPolygonsDataFrame(SpatialPolygons(list(Polygons(list(Polygon(cds1)), 1), 
-                                                       Polygons(list(Polygon(cds2)), 2))),data.frame(ID=c(1,2)))
-
-## do extraction in abstract terms
-(cn <- cellnumbers(r, polys))
+
## Warning: projections not the same 
 ##     x: +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0
 ## query: NA
+
## Warning in cellnumbers.default(r, polys): cellnumbers is very slow for
+## SpatialPolygons, consider conversion with 'sf::st_as_sf'
## # A tibble: 63 x 2
 ##    object_ cell_
 ##      <int> <dbl>
@@ -270,97 +286,96 @@ 

## 9 1 334 ## 10 1 335 ## # ... with 53 more rows

-
library(dplyr)
-## now perform extraction for real
-## and pipe into grouping by polygon (object_) and value, and
-## calculate class percentage from class counts per polygon
-cn %>% mutate(v = raster::extract(r, cell_)) %>% group_by(object_, v) %>% summarize(count = n()) %>% 
-  mutate(v.pct = count / sum(count)) 
-
## # A tibble: 19 x 4
+
+
## # A tibble: 18 x 4
 ## # Groups:   object_ [2]
-##    object_     v count      v.pct
-##      <int> <dbl> <int>      <dbl>
-##  1       1     1     1 0.02631579
-##  2       1     2     3 0.07894737
-##  3       1     3     4 0.10526316
-##  4       1     4     4 0.10526316
-##  5       1     5     5 0.13157895
-##  6       1     6     8 0.21052632
-##  7       1     7     4 0.10526316
-##  8       1     8     5 0.13157895
-##  9       1     9     3 0.07894737
-## 10       1    10     1 0.02631579
-## 11       2     2     4 0.16000000
-## 12       2     3     6 0.24000000
-## 13       2     4     1 0.04000000
-## 14       2     5     2 0.08000000
-## 15       2     6     2 0.08000000
-## 16       2     7     1 0.04000000
-## 17       2     8     5 0.20000000
-## 18       2     9     3 0.12000000
-## 19       2    10     1 0.04000000
-
## here is the traditional code used in the stackoverflow example
-# Extract raster values to polygons                             
-#( v <- extract(r, polys) )
-# Get class counts for each polygon
-#v.counts <- lapply(v,table)
-# Calculate class percentages for each polygon
-#( v.pct <- lapply(v.counts, FUN=function(x){ x / sum(x) } ) )
+## object_ v count v.pct +## <int> <dbl> <int> <dbl> +## 1 1 1 1 0.0263 +## 2 1 2 6 0.158 +## 3 1 3 2 0.0526 +## 4 1 4 3 0.0789 +## 5 1 5 4 0.105 +## 6 1 6 7 0.184 +## 7 1 7 8 0.211 +## 8 1 8 5 0.132 +## 9 1 10 2 0.0526 +## 10 2 1 4 0.16 +## 11 2 2 3 0.12 +## 12 2 3 4 0.16 +## 13 2 4 2 0.08 +## 14 2 5 3 0.12 +## 15 2 6 2 0.08 +## 16 2 7 1 0.04 +## 17 2 8 2 0.08 +## 18 2 9 4 0.16
+

Extract cell numbers

-
library(tabularaster)
-data("ghrsst")  ## a RasterLayer
-data("sst_regions") ## a polygon layer, contiguous with ghrsst
-
-gcells <- cellnumbers(ghrsst, sst_regions) %>% mutate(object_ = as.integer(object_))
-
-result <- gcells %>% mutate(sst = raster::extract(ghrsst, cell_)) %>% 
-  group_by(object_) %>% 
-  summarize_at(vars(sst), funs(mean(., na.rm = TRUE), sd(., na.rm = TRUE), length))
-
-library(spdplyr)
-sst_regions <- sst_regions %>% inner_join(result, c("ghrsst" = "object_"))
-
-plot(ghrsst, col = bpy.colors(30), addfun = function() plot(sst_regions, add = TRUE), 
-     main = "SST data with simple regional polygon layer")
-

-
#library(sf)
-plot(sst_regions)
-

+ +
## Warning in cellnumbers.default(ghrsst, sst_regions): cellnumbers is very
+## slow for SpatialPolygons, consider conversion with 'sf::st_as_sf'
+
result <- gcells %>% mutate(sst = raster::extract(ghrsst, cell_)) %>% 
+  group_by(object_) %>% 
+  summarize_at(vars(sst), funs(mean(., na.rm = TRUE), sd(., na.rm = TRUE), length))
+
+library(spdplyr)
+sst_regions <- sst_regions %>% inner_join(result, c("ghrsst" = "object_"))
+
+plot(ghrsst, col = bpy.colors(30), addfun = function() plot(sst_regions, add = TRUE), 
+     main = "SST data with simple regional polygon layer")
+

+
#library(sf)
+plot(sst_regions)
+

Extract cells from rasters

-
library(tabularaster)
-library(raster)
-library(dplyr)
-data("rastercano")
-data("polycano")
-cells <- cellnumbers(rastercano, polycano[4:5, ])
+
## Warning: projections not the same 
 ##     x: NA
 ## query: NA
-
cellnumbers(rastercano, as(polycano[4:5, ], "SpatialLinesDataFrame"))
-
## Warning: projections not the same 
-##     x: NA
-## query: NA
-
## # A tibble: 235 x 2
+
## Warning in cellnumbers.default(rastercano, polycano[4:5, ]): cellnumbers is
+## very slow for SpatialPolygons, consider conversion with 'sf::st_as_sf'
+ +
## # A tibble: 305 x 2
 ##    object_ cell_
-##      <int> <dbl>
+##      <int> <int>
 ##  1       1  1129
 ##  2       1  1190
 ##  3       1  1251
-##  4       2     1
-##  5       2     2
-##  6       2     3
-##  7       2     4
-##  8       2     5
-##  9       2     6
-## 10       2     7
-## # ... with 225 more rows
-
cellnumbers(rastercano, as(as(polycano[4:5, ], "SpatialLinesDataFrame"), "SpatialPointsDataFrame"))
+## 4 2 854 +## 5 2 915 +## 6 2 976 +## 7 2 1037 +## 8 2 1098 +## 9 3 1 +## 10 3 2 +## # ... with 295 more rows
+
## Warning: projections not the same 
 ##     x: NA
 ## query: NA
@@ -379,54 +394,87 @@

## 10 1 1037 ## # ... with 321 more rows

In the case of polygons, there’s an argument weights that can be used to get an approximate weighting for partial cell coverage.

-
poly <- sf::st_sf(a = 1, geometry = sf::st_sfc(sf::st_polygon(list(
-  cbind(c(0.57, 0.55, 0.19, 0.43, 0.82, 0.57), 
-        c(0.22, 0.24, 0.46, 0.77, 0.56, 0.22))))))
-
-
-
-
-xweight <- cellnumbers(rastercano, poly, weights = TRUE)
-
-dgrid <- setValues(rastercano, NA_real_)
-dgrid[xweight$cell_] <- xweight$weight_
-plot(dgrid, main = "cell weights based on partial overlap", col = viridis::viridis(9), 
-     addfun = function() polygon(poly$geometry[[c(1, 1)]]))
+

Extract values or cell numbers with sf object

It’s an unfortunate symptom of fragmentation in the R spatial tools that two of the best and most highly used packages raster and sf have no formal way to be used together.

Here we use the extent capability of spex, and the tabularaster tools extract and cellnumbers to build a raster from an sf layer.

-
library(sf)
-
-poly <- read_sf(system.file("shape/nc.shp", package="sf"))
-library(spex)
-extent(poly)
-spex(poly)
-## we can't do this
-try(grid <-  raster(poly))
-
-## but we can do 
-
-(grid <- raster(spex(poly), nrow = 100, ncol = 140))
-
-## index the raster with the sf layer
-(cn <- cellnumbers(grid, poly))
-
-grid[cn$cell_] <- cn$object_
-
-## we slasterized it (slow rasterize)
-plot(grid)
-

That’s nice, since we can actually use extract with the cell numbers, rather than the sf object. This is preferable for repeated use of the extraction, e.g. for time series extraction where we need to visit each time step iteratively. (Raster is already index-optimized for multi-layers raster objects).

+ +

That’s nice, since we can actually use extract with the cell numbers, rather than the sf object. This is preferable for repeated use of the extraction, e.g. for time series extraction where we need to visit each time step iteratively. (Raster is already index-optimized for multi-layers raster objects).

Now use fasterize to generate the grid, and use cellnumbers to extract.

-
## fasterize it
-library(fasterize)
-#poly$object_ <- as.integer(seq_len(nrow(poly)))
-fgrid <- fasterize(poly, grid, field = "AREA")
-scl <- function(x) {rg <- range(x, na.rm = TRUE); (x   - rg[1])/diff(rg)}
-plot(xyFromCell(grid, cn$cell_), pch = 19, cex = 0.4, col = bpy.colors(26)[scl(raster::extract(fgrid, cn$cell_)) * 25 + 1])
-
+
## fasterize it
+library(fasterize)
+#poly$object_ <- as.integer(seq_len(nrow(poly)))
+fgrid <- fasterize(poly, grid, field = "AREA")
+scl <- function(x) {rg <- range(x, na.rm = TRUE); (x   - rg[1])/diff(rg)}
+plot(xyFromCell(grid, cn$cell_), pch = 19, cex = 0.4, col = bpy.colors(26)[scl(raster::extract(fgrid, cn$cell_)) * 25 + 1])
+

Use velox instead

+
library(spex)
+library(raster)
+library(tabularaster)
+## but we can do 
+(grid <- raster(spex(sst_regions), res = 0.2))
+system.time({
+library(velox)
+vx <- velox(setValues(grid, 0))
+vx$rasterize(sf::st_as_sf(sst_regions), field = "ghrsst")
+
+library(dplyr)
+res1 <- as_tibble(vx$as.RasterLayer()) %>% 
+  #rename(object_ = cellvalue) %>% 
+  filter(!is.na(cellvalue))
+})
+
+
+system.time({
+  res2 <- as_tibble(rasterize(sst_regions, grid, field = sst_regions$ghrsst))
+})
+
+vcellnumbers <- function(x, query, ...) {
+  query$object_ <- seq_len(nrow(query))
+  query <- sf::st_as_sf(query)
+  x <- setValues(x[[1]], 1)
+  vx <- velox(x)
+  vx$rasterize(query, field = "object_")
+  vx$as.RasterLayer() %>%   
+    as_tibble(na.rm = FALSE) %>% 
+    dplyr::rename(object_ = cellvalue, cell_ = cellindex)
+}
+vcellnumbers(grid, sst_regions)
+cellnumbers(grid, sst_regions)
@@ -458,11 +506,13 @@

-

Site built with pkgdown.

+

Site built with pkgdown.

+ + diff --git a/docs/articles/tabularaster-usage_files/figure-html/unnamed-chunk-7-1.png b/docs/articles/tabularaster-usage_files/figure-html/unnamed-chunk-7-1.png index c6e7f73..0375c28 100644 Binary files a/docs/articles/tabularaster-usage_files/figure-html/unnamed-chunk-7-1.png and b/docs/articles/tabularaster-usage_files/figure-html/unnamed-chunk-7-1.png differ diff --git a/docs/articles/tabularaster-usage_files/figure-html/unnamed-chunk-7-2.png b/docs/articles/tabularaster-usage_files/figure-html/unnamed-chunk-7-2.png index 55c0986..440aa2f 100644 Binary files a/docs/articles/tabularaster-usage_files/figure-html/unnamed-chunk-7-2.png and b/docs/articles/tabularaster-usage_files/figure-html/unnamed-chunk-7-2.png differ diff --git a/docs/authors.html b/docs/authors.html index 105bb11..2d7a429 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -25,6 +25,9 @@ + + + @@ -52,7 +55,7 @@ tabularaster - 0.4.0 + 0.5.0
@@ -95,6 +98,7 @@ +
@@ -102,8 +106,8 @@ -
-
+
+
@@ -132,6 +136,8 @@

Authors

+ + diff --git a/docs/docsearch.css b/docs/docsearch.css new file mode 100644 index 0000000..c524034 --- /dev/null +++ b/docs/docsearch.css @@ -0,0 +1,145 @@ +/* Docsearch -------------------------------------------------------------- */ +/* + Source: https://github.com/algolia/docsearch/ + License: MIT +*/ + +.algolia-autocomplete { + display: block; + -webkit-box-flex: 1; + -ms-flex: 1; + flex: 1 +} + +.algolia-autocomplete .ds-dropdown-menu { + width: 100%; + min-width: none; + max-width: none; + padding: .75rem 0; + background-color: #fff; + background-clip: padding-box; + border: 1px solid rgba(0, 0, 0, .1); + box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .175); +} + +@media (min-width:768px) { + .algolia-autocomplete .ds-dropdown-menu { + width: 175% + } +} + +.algolia-autocomplete .ds-dropdown-menu::before { + display: none +} + +.algolia-autocomplete .ds-dropdown-menu [class^=ds-dataset-] { + padding: 0; + background-color: rgb(255,255,255); + border: 0; + max-height: 80vh; +} + +.algolia-autocomplete .ds-dropdown-menu .ds-suggestions { + margin-top: 0 +} + +.algolia-autocomplete .algolia-docsearch-suggestion { + padding: 0; + overflow: visible +} + +.algolia-autocomplete .algolia-docsearch-suggestion--category-header { + padding: .125rem 1rem; + margin-top: 0; + font-size: 1.3em; + font-weight: 500; + color: #00008B; + border-bottom: 0 +} + +.algolia-autocomplete .algolia-docsearch-suggestion--wrapper { + float: none; + padding-top: 0 +} + +.algolia-autocomplete .algolia-docsearch-suggestion--subcategory-column { + float: none; + width: auto; + padding: 0; + text-align: left +} + +.algolia-autocomplete .algolia-docsearch-suggestion--content { + float: none; + width: auto; + padding: 0 +} + +.algolia-autocomplete .algolia-docsearch-suggestion--content::before { + display: none +} + +.algolia-autocomplete .ds-suggestion:not(:first-child) .algolia-docsearch-suggestion--category-header { + padding-top: .75rem; + margin-top: .75rem; + border-top: 1px solid rgba(0, 0, 0, .1) +} + +.algolia-autocomplete .ds-suggestion .algolia-docsearch-suggestion--subcategory-column { + display: block; + padding: .1rem 1rem; + margin-bottom: 0.1; + font-size: 1.0em; + font-weight: 400 + /* display: none */ +} + +.algolia-autocomplete .algolia-docsearch-suggestion--title { + display: block; + padding: .25rem 1rem; + margin-bottom: 0; + font-size: 0.9em; + font-weight: 400 +} + +.algolia-autocomplete .algolia-docsearch-suggestion--text { + padding: 0 1rem .5rem; + margin-top: -.25rem; + font-size: 0.8em; + font-weight: 400; + line-height: 1.25 +} + +.algolia-autocomplete .algolia-docsearch-footer { + float: none; + width: auto; + height: auto; + padding: .75rem 1rem 0; + font-size: .95rem; + line-height: 1; + color: #767676; + background-color: rgb(255, 255, 255); + border-top: 1px solid rgba(0, 0, 0, .1) +} + +.algolia-autocomplete .algolia-docsearch-footer--logo { + display: inline; + overflow: visible; + color: inherit; + text-indent: 0; + background: 0 0 +} + +.algolia-autocomplete .algolia-docsearch-suggestion--highlight { + color: #FF8C00; + background: rgba(232, 189, 54, 0.1) +} + + +.algolia-autocomplete .algolia-docsearch-suggestion--text .algolia-docsearch-suggestion--highlight { + box-shadow: inset 0 -2px 0 0 rgba(105, 105, 105, .5) +} + +.algolia-autocomplete .ds-suggestion.ds-cursor .algolia-docsearch-suggestion--content { + background-color: rgba(192, 192, 192, .15) +} diff --git a/docs/index.html b/docs/index.html index 09448f7..3e00889 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,57 +1,31 @@ - - - - + + + + - Tidy Tools for 'Raster' Data • tabularaster - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - -
-
- + +
+ -
-
- +
+
+ -
-

Travis-CI Build Status AppVeyor Build Status Coverage Status CRAN_Status_Badge CRAN RStudio mirror downloads

+
-

tabularaster

-

The raster package is extremely powerful in the R ecosystem for spatial data. It can be used very efficiently to drive data extraction and summary tools using its consistent cell-index and comprehensive helper functions for converting between cell values and less abstract raster grid properties.

-

Tabularaster provides some more helpers for working with cells and tries to fill some of the (very few!) gaps in raster functionality. When raster returns cell values of hierarchical objects it returns a hierarchical (list) of cells to match the input query.

-

Tabularaster provides on a few simple functions.

+ +

The raster package is extremely powerful for spatial data. It provides very efficient data extraction and summary tools via consistent cell-index and comprehensive set of functions for working with grids, cells and their values.

+

Tabularaster provides some more helpers for working with cells and tries to fill some of the (very few!) gaps in raster functionality. When raster returns cell values of hierarchical objects it returns a hierarchical (list) of cells to match the input query, while tabularaster::cellnumbers instead returns a data frame of identifiers and cell numbers.

+

Tabularaster provides these functions.

    -
  • as_tibble - convert to data frame with options for value column and cell, dimension and date indexing
  • -
  • cellnumbers - extract of cell index numbers as a simple data frame with “object ID” and “cell index”
  • -
  • extentFromCells - create an extent from cell index numbers
  • -
  • index_extent - create an index extent, essentially extent(0, ncol(raster), 0, nrow(raster))
  • +
  • +as_tibble - convert to data frame with options for value column and cell, dimension and date indexing
  • +
  • +cellnumbers - extract of cell index numbers as a simple data frame with “object ID” and “cell index”
  • +
  • +index_extent - create an index extent, essentially extent(0, ncol(raster), 0, nrow(raster)) +

All functions that work with sp Spatial also work with `sf simple features.

There is some overlap with quadmesh and spex while I figure out where things belong.

-

Installation

-

Install from CRAN, or get the development version from Github.

-
devtools::install_github("hypertidy/tabularaster")
+

+Installation

+

Install from CRAN,

+ +

or get the development version from Github.

+
devtools::install_github("hypertidy/tabularaster")
-

Usage

+

+Usage

Basic usage is to extract the cell numbers from an object, where object is a a matrix of points, a Spatial object or a simple features sf object.

-
cells <- cellnumbers(raster, object)
+

The value in this approach is not for getting cell numbers per se, but for using those downstream. The cell number is an index into the raster that means the geometric hard work is done, so we can apply the index for subsequent extractions, grouping aggregations, or for determining the coordinates or other structure summaries of where the cell belongs.

E.g.

-

-## summarize by object grouping
-cells %>% mutate(value= extract(raster, cell_)) %>% group_by(object_) %>% summarize(mean(value))
-
-## summarize by cell grouping
-cells %>% mutate(value= extract(raster, cell_)) %>% group_by(cell_) %>% summarize(mean(value))
+

The utility of this is very much dependent on individual workflow, so this in its own right is not very exciting. Tabularaster simply provides an easier way to create your tools.

See the vignettes for more.

-
+
+ + diff --git a/docs/jquery.sticky-kit.min.js b/docs/jquery.sticky-kit.min.js index e2a3c6d..1c16271 100644 --- a/docs/jquery.sticky-kit.min.js +++ b/docs/jquery.sticky-kit.min.js @@ -1,5 +1,7 @@ +/* Sticky-kit v1.1.2 | WTFPL | Leaf Corcoran 2015 | */ /* - Sticky-kit v1.1.2 | WTFPL | Leaf Corcoran 2015 | http://leafo.net + Source: https://github.com/leafo/sticky-kit + License: MIT */ (function(){var b,f;b=this.jQuery||window.jQuery;f=b(window);b.fn.stick_in_parent=function(d){var A,w,J,n,B,K,p,q,k,E,t;null==d&&(d={});t=d.sticky_class;B=d.inner_scrolling;E=d.recalc_every;k=d.parent;q=d.offset_top;p=d.spacer;w=d.bottoming;null==q&&(q=0);null==k&&(k=void 0);null==B&&(B=!0);null==t&&(t="is_stuck");A=b(document);null==w&&(w=!0);J=function(a,d,n,C,F,u,r,G){var v,H,m,D,I,c,g,x,y,z,h,l;if(!a.data("sticky_kit")){a.data("sticky_kit",!0);I=A.height();g=a.parent();null!=k&&(g=g.closest(k)); if(!g.length)throw"failed to find stick parent";v=m=!1;(h=null!=p?p&&a.closest(p):b("
"))&&h.css("position",a.css("position"));x=function(){var c,f,e;if(!G&&(I=A.height(),c=parseInt(g.css("border-top-width"),10),f=parseInt(g.css("padding-top"),10),d=parseInt(g.css("padding-bottom"),10),n=g.offset().top+c+f,C=g.height(),m&&(v=m=!1,null==p&&(a.insertAfter(h),h.detach()),a.css({position:"",top:"",width:"",bottom:""}).removeClass(t),e=!0),F=a.offset().top-(parseInt(a.css("margin-top"),10)||0)-q, diff --git a/docs/news/index.html b/docs/news/index.html index 810a544..69c3d47 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -6,7 +6,7 @@ -All news • tabularaster +Changelog • tabularaster @@ -18,13 +18,19 @@ + + - - + + + + + + @@ -47,12 +53,16 @@ - tabularaster + + tabularaster + 0.5.0 +
+
@@ -93,17 +106,27 @@ -
- -
+
+
-
+
+

+tabularaster 0.4.0 2017-12-10 +

+
    +
  • add xy argument to as_tibble

  • +
  • fix missing vignette knitr reference

  • +
  • new oisst data set

  • +
+
-

-tabularaster 0.3.0

+

+tabularaster 0.3.0 2017-08-05 +

  • bufext made defunct

  • added index extent functions index_extent and cellsFromExtent

  • @@ -120,21 +143,22 @@

-

-tidyraster 0.2.0

+

+tidyraster 0.2.0 Unreleased +

  • new data sets rastercano and polycano

  • new functions decimate, cellnumbers and bufext

  • Added a NEWS.md file to track changes to the package.

-
+ + + diff --git a/docs/pkgdown.css b/docs/pkgdown.css index fcd97bb..c5ab586 100644 --- a/docs/pkgdown.css +++ b/docs/pkgdown.css @@ -217,3 +217,11 @@ a.sourceLine:hover { .hasCopyButton:hover button.btn-copy-ex { visibility: visible; } + +/* mark.js ----------------------------*/ + +mark { + background-color: rgba(255, 255, 51, 0.5); + border-bottom: 2px solid rgba(255, 153, 51, 0.3); + padding: 1px; +} diff --git a/docs/pkgdown.js b/docs/pkgdown.js index 362b060..16d5750 100644 --- a/docs/pkgdown.js +++ b/docs/pkgdown.js @@ -33,6 +33,45 @@ $(function() { }); }); +$(document).ready(function() { + // do keyword highlighting + /* modified from https://jsfiddle.net/julmot/bL6bb5oo/ */ + var mark = function() { + + var referrer = document.URL ; + var paramKey = "q" ; + + if (referrer.indexOf("?") !== -1) { + var qs = referrer.substr(referrer.indexOf('?') + 1); + var qs_noanchor = qs.split('#')[0]; + var qsa = qs_noanchor.split('&'); + var keyword = ""; + + for (var i = 0; i < qsa.length; i++) { + var currentParam = qsa[i].split('='); + + if (currentParam.length !== 2) { + continue; + } + + if (currentParam[0] == paramKey) { + keyword = decodeURIComponent(currentParam[1].replace(/\+/g, "%20")); + } + } + + if (keyword !== "") { + $(".contents").unmark({ + done: function() { + $(".contents").mark(keyword); + } + }); + } + } + }; + + mark(); +}); + function paths(pathname) { var pieces = pathname.split("/"); pieces.shift(); // always starts with / @@ -99,3 +138,37 @@ if(Clipboard.isSupported()) { }); } +/* Search term highlighting ------------------------------*/ + +function matchedWords(hit) { + var words = []; + + var hierarchy = hit._highlightResult.hierarchy; + // loop to fetch from lvl0, lvl1, etc. + for (var idx in hierarchy) { + words = words.concat(hierarchy[idx].matchedWords); + } + + var content = hit._highlightResult.content; + if (content) { + words = words.concat(content.matchedWords); + } + + // return unique words + var words_uniq = [...new Set(words)]; + return words_uniq; +} + +function updateHitURL(hit) { + + var words = matchedWords(hit); + var url = ""; + + if (hit.anchor) { + url = hit.url_without_anchor + '?q=' + escape(words.join(" ")) + '#' + hit.anchor; + } else { + url = hit.url + '?q=' + escape(words.join(" ")); + } + + return url; +} diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 4994c8f..2bac168 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -1,6 +1,6 @@ -pandoc: 1.19.2.4 -pkgdown: 0.1.0.9000 -pkgdown_sha: 5e4825875751c009444c56ce43d06324ec53e910 +pandoc: '2.2' +pkgdown: 1.0.0.9000 +pkgdown_sha: 5eeb2aab0b68924bcde72ded0f7326070eaa0fa0 articles: cell-index-raster-abstraction: cell-index-raster-abstraction.html tabularaster-usage: tabularaster-usage.html diff --git a/docs/reference/as_tibble.html b/docs/reference/as_tibble.html index 8a2e418..177ceb7 100644 --- a/docs/reference/as_tibble.html +++ b/docs/reference/as_tibble.html @@ -18,13 +18,24 @@ + + - - + + + + + + + + + @@ -47,12 +58,16 @@ - tabularaster + + tabularaster + 0.5.0 +
+
@@ -93,23 +111,27 @@ -
+
+

Generate a data frame version of any raster object. Use the arguments 'cell', 'dim', 'split_date' and 'value' to control the columns that are included in the output.

+
# S3 method for BasicRaster
 as_tibble(x, cell = TRUE, dim = nlayers(x) > 1L,
-  value = TRUE, split_date = FALSE, ...)
+ value = TRUE, split_date = FALSE, xy = FALSE, ...) -

Arguments

+

Arguments

@@ -132,6 +154,10 @@

Ar

+ + + + @@ -176,11 +202,14 @@

Contents

-

Site built with pkgdown.

+

Site built with pkgdown.

+ + + diff --git a/docs/reference/bufext.html b/docs/reference/bufext.html index 65b5234..522efd0 100644 --- a/docs/reference/bufext.html +++ b/docs/reference/bufext.html @@ -18,13 +18,22 @@ + + - - + + + + + + + + + @@ -47,12 +56,16 @@ - tabularaster + + tabularaster + 0.5.0 + + @@ -93,19 +109,23 @@ -
+
+

Ensure a raster extent aligns to whole parts.

+
bufext(e1, e2)
-

Arguments

+

Arguments

split_date

logical to split date into components

xy

logical to include the x and y centre coordinate of each cell

...

unused

@@ -125,8 +145,7 @@

Details

Examples

library(spex) -library(raster) -buffer_extent(extent(0.1, 2.2, 0, 3), 2)
#> class : Extent +library(raster)
#> Loading required package: sp
buffer_extent(extent(0.1, 2.2, 0, 3), 2)
#> class : Extent #> xmin : 0 #> xmax : 4 #> ymin : 0 @@ -151,11 +170,14 @@

Contents

-

Site built with pkgdown.

+

Site built with pkgdown.

+ + + diff --git a/docs/reference/cellnumbers.html b/docs/reference/cellnumbers.html index 53dbd56..ece58dd 100644 --- a/docs/reference/cellnumbers.html +++ b/docs/reference/cellnumbers.html @@ -18,13 +18,24 @@ + + - - + + + + + + + + + @@ -47,12 +58,16 @@ - tabularaster + + tabularaster + 0.5.0 + + @@ -93,21 +111,37 @@ -
+
+

Provide the 'cellnumbers' capability of raster::extract and friends directly, returning a data frame of query-object identifiers 'object_' and the cell number.

+
+ +
cellnumbers(x, query, ...)
 
-    
cellnumbers(x, query, ...)
+# S3 method for default +cellnumbers(x, query, ...) + +# S3 method for SpatialLines +cellnumbers(x, query, ...) + +# S3 method for sfc +cellnumbers(x, query, ...) + +# S3 method for sf +cellnumbers(x, query, ...)
-

Arguments

+

Arguments

@@ -120,7 +154,7 @@

Ar

- +
...

arguments passed on to raster::cellFromPolygon for polygon input

unused

@@ -136,20 +170,23 @@

Details the the standard "raster graphics" convention used by 'GDAL' and the 'sp' package, and many other implementations. Note that this is different to the convention used by the graphics::image function.

-

Currently this function only operats as if the input is a single layer objects, it's not clear if adding +

Currently this function only operates as if the input is a single layer objects, it's not clear if adding an extra level of grouping for layers would be sensible.

-

The dots argument can be used to set weights=TRUE for the polygon case, this is otherwise ignored.

Examples

library(raster) -library(dplyr) -r <- raster(volcano) %>% aggregate(fact = 4) -cellnumbers(r, rasterToContour(r, level = 120))
#> Warning: projections not the same -#> x: NA -#> query: NA
#> # A tibble: 64 x 2 +library(dplyr)
#> +#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:raster’: +#> +#> intersect, select, union
#> The following objects are masked from ‘package:stats’: +#> +#> filter, lag
#> The following objects are masked from ‘package:base’: +#> +#> intersect, setdiff, setequal, union
r <- raster(volcano) %>% aggregate(fact = 4) +cellnumbers(r, rasterToContour(r, level = 120))
#> # A tibble: 64 x 2 #> object_ cell_ -#> <int> <dbl> +#> <int> <int> #> 1 1 8 #> 2 1 9 #> 3 1 10 @@ -194,11 +231,14 @@

Contents

-

Site built with pkgdown.

+

Site built with pkgdown.

+ + + diff --git a/docs/reference/ghrsst-1.png b/docs/reference/ghrsst-1.png index 9bac073..3de37f5 100644 Binary files a/docs/reference/ghrsst-1.png and b/docs/reference/ghrsst-1.png differ diff --git a/docs/reference/ghrsst.html b/docs/reference/ghrsst.html index 700fa0b..8c0845c 100644 --- a/docs/reference/ghrsst.html +++ b/docs/reference/ghrsst.html @@ -18,13 +18,22 @@ + + - - + + + + + + + + + @@ -47,12 +56,16 @@ - tabularaster + + tabularaster + 0.5.0 +
+
@@ -93,15 +109,19 @@ -
+
+

A smoothed subset of GHRSST.

+

Format

@@ -111,13 +131,13 @@

FormatDetails

See "data-raw/ghrsst.R" and "data-raw/ghrsst-readme.txt" for -details. - sst_regions is a simple polygon region layer to sit over the SST data.

+details.

+

sst_regions is a simple polygon region layer to sit over the SST data.

Examples

library(raster) -plot(ghrsst, col = viridis::viridis(100))
plot(sst_regions, add = TRUE, col = NA)
## cellnumbers(ghrsst, sst_regions) +plot(ghrsst, col = viridis::viridis(100))
plot(sst_regions, add = TRUE, col = NA)
## cellnumbers(ghrsst, sst_regions)
-

Site built with pkgdown.

+

Site built with pkgdown.

+ + + diff --git a/docs/reference/index.html b/docs/reference/index.html index 082bbcb..80d842d 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -18,13 +18,19 @@ + + - - + + + + + + @@ -47,12 +53,16 @@ - tabularaster + + tabularaster + 0.5.0 +
+
@@ -93,94 +106,96 @@ -
-
+
+
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

All functions

-

-
-

-

Convert a Raster to a data frame.

-

bufext

-

Defunct tabularaster function

-

cellnumbers

-

Extract cell numbers from a Raster object.

-

extentFromCells

-

Extent from cells

-

-

Sea surface temperature data.

-

index_extent

-

Index extent

-

-

The raster volcano as polygons.

-

-

The raster volcano.

-

-

Sharkcano, the shark and the volcano.

-

-

Tabular tools for raster, tidy tools for raster.

-
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

All functions

+

+
+

as_tibble(<BasicRaster>)

+

Convert a Raster to a data frame.

+

bufext()

+

Defunct tabularaster function

+

cellnumbers()

+

Extract cell numbers from a Raster object.

+

ghrsst

+

Sea surface temperature data.

+

index_extent()

+

Index extent

+

oisst

+

Optimally interpolated SST in near-native form.

+

polycano

+

The raster volcano as polygons.

+

raster-exports

+

Re-exports from raster

+

rastercano

+

The raster volcano.

+

sharkcano

+

Sharkcano, the shark and the volcano.

+

tabularaster

+

Tabular tools for raster, tidy tools for raster.

-

Site built with pkgdown.

+

Site built with pkgdown.

+ + + diff --git a/docs/reference/index_extent.html b/docs/reference/index_extent.html index 11f9c92..cb0b460 100644 --- a/docs/reference/index_extent.html +++ b/docs/reference/index_extent.html @@ -18,13 +18,22 @@ + + - - + + + + + + + + + @@ -47,12 +56,16 @@ - tabularaster + + tabularaster + 0.5.0 +
+
@@ -93,19 +109,23 @@ -
+
+

Extent in index space.

+
index_extent(x, ex)
-

Arguments

+

Arguments

@@ -147,11 +167,14 @@

Contents

-

Site built with pkgdown.

+

Site built with pkgdown.

+ + + diff --git a/docs/reference/oisst.html b/docs/reference/oisst.html new file mode 100644 index 0000000..45ebb51 --- /dev/null +++ b/docs/reference/oisst.html @@ -0,0 +1,163 @@ + + + + + + + + +Optimally interpolated SST in near-native form. — oisst • tabularaster + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ +
+
+ + +
+ +

See data-raw/oisst.R in the source repository. The file was +avhrr-only-v2.20170729.nc, its extent -180, 180, -90, 90 with +dimensions 1440x720 in the usual raster configuration.

+ +
+ + +

Format

+ +

A data frame of sst values created from OISST data.

+ + +
+ +
+ +
+ + +
+

Site built with pkgdown.

+
+ +
+
+ + + + + + diff --git a/docs/reference/pipe.html b/docs/reference/pipe.html new file mode 100644 index 0000000..7a6340b --- /dev/null +++ b/docs/reference/pipe.html @@ -0,0 +1,154 @@ + + + + + + + + +Pipe operator — %>% • tabularaster + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ +
+
+ + +
+ +

See magrittr::%>% for details.

+ +
+ +
lhs %>% rhs
+ + +
+ +
+ +
+ + +
+

Site built with pkgdown.

+
+ +
+
+ + + + + + diff --git a/docs/reference/polycano.html b/docs/reference/polycano.html index 75af9fb..6dd6ade 100644 --- a/docs/reference/polycano.html +++ b/docs/reference/polycano.html @@ -18,13 +18,22 @@ + + - - + + + + + + + + + @@ -47,12 +56,16 @@ - tabularaster + + tabularaster + 0.5.0 + + @@ -93,15 +109,19 @@ -
+
+

See data-raw/rastercano.r in the source repository.

+

Format

@@ -126,11 +146,14 @@

Contents

-

Site built with pkgdown.

+

Site built with pkgdown.

+ + + diff --git a/docs/reference/raster-exports.html b/docs/reference/raster-exports.html new file mode 100644 index 0000000..ac426d9 --- /dev/null +++ b/docs/reference/raster-exports.html @@ -0,0 +1,159 @@ + + + + + + + + +Re-exports from raster — raster-exports • tabularaster + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ +
+
+ + +
+ +

These functions are imported and then re-exported.

+ +
+ + +

Details

+ +

See raster::extentFromCells for details.

+ + +
+ +
+ +
+ + +
+

Site built with pkgdown.

+
+ +
+
+ + + + + + diff --git a/docs/reference/rastercano.html b/docs/reference/rastercano.html index a770f7e..9dd018c 100644 --- a/docs/reference/rastercano.html +++ b/docs/reference/rastercano.html @@ -18,13 +18,22 @@ + + - - + + + + + + + + + @@ -47,12 +56,16 @@ - tabularaster + + tabularaster + 0.5.0 +
+ @@ -93,15 +109,19 @@ -
+
+

See data-raw/rastercano.r in the source repository.

+

Format

@@ -126,11 +146,14 @@

Contents

-

Site built with pkgdown.

+

Site built with pkgdown.

+ + + diff --git a/docs/reference/sharkcano.html b/docs/reference/sharkcano.html index 6bf8e30..73f6b2b 100644 --- a/docs/reference/sharkcano.html +++ b/docs/reference/sharkcano.html @@ -18,13 +18,24 @@ + + - - + + + + + + + + + @@ -47,12 +58,16 @@ - tabularaster + + tabularaster + 0.5.0 +
+ @@ -93,17 +111,21 @@ -
+
+

This is just a free image off the internetz. The image was read in and all non-essential items dropped. The dimensions in raster::raster terms is stored in attr(sharkcano, "rasterdim").

+

Format

@@ -153,11 +175,14 @@

Contents

-

Site built with pkgdown.

+

Site built with pkgdown.

+ + + diff --git a/docs/reference/tabularaster.html b/docs/reference/tabularaster.html index 9f45129..f6e2737 100644 --- a/docs/reference/tabularaster.html +++ b/docs/reference/tabularaster.html @@ -18,13 +18,22 @@ + + - - + + + + + + + + + @@ -47,12 +56,16 @@ - tabularaster + + tabularaster + 0.5.0 +
+ @@ -93,33 +109,30 @@ -
+
+

Tabular tools for raster, tidy tools for raster.

+

Details

-

Tabularaster includes these main functions.

- - - - - - - -
-as_tibble -as_tibble convert raster data to data frame form, with control over output and form of dimension/coordinate columns
-cellnumbers extract a data frame of query identifiers and cell,pixel index numbers
-extentFromCells build an Extent object from cell numbers
-index_extent build an extent in row column form, as opposed to coordinate value form
+

Tabularaster includes these main functions.

+ + + + +
as_tibble +as_tibbleconvert raster data to data frame form, with control over output and form of dimension/coordinate columns
cellnumbersextract a data frame of query identifiers and cell,pixel index numbers
extentFromCells(now incorporated into raster itself)
index_extentbuild an extent in row column form, as opposed to coordinate value form
@@ -139,11 +152,14 @@

Contents

-

Site built with pkgdown.

+

Site built with pkgdown.

+ + +