| 1 |
|
| 2 |
R version 4.3.1 (2023-06-16) -- "Beagle Scouts" |
| 3 |
Copyright (C) 2023 The R Foundation for Statistical Computing |
| 4 |
Platform: x86_64-pc-linux-gnu (64-bit) |
| 5 |
|
| 6 |
R is free software and comes with ABSOLUTELY NO WARRANTY. |
| 7 |
You are welcome to redistribute it under certain conditions. |
| 8 |
Type 'license()' or 'licence()' for distribution details. |
| 9 |
|
| 10 |
R is a collaborative project with many contributors. |
| 11 |
Type 'contributors()' for more information and |
| 12 |
'citation()' on how to cite R or R packages in publications. |
| 13 |
|
| 14 |
Type 'demo()' for some demos, 'help()' for on-line help, or |
| 15 |
'help.start()' for an HTML browser interface to help. |
| 16 |
Type 'q()' to quit R. |
| 17 |
|
| 18 |
> options("rgdal_show_exportToProj4_warnings"="none") |
| 19 |
> library(sp) |
| 20 |
> xy = expand.grid(x = 1:4, y = 1:4) |
| 21 |
> xy.sp = SpatialPoints(xy) |
| 22 |
> gridded(xy.sp) = T |
| 23 |
> # deselect 1 row and 2 col: |
| 24 |
> tst = xy.sp[-c(2,6,10,14,9,11,12)] |
| 25 |
> tst |
| 26 |
Object of class SpatialPixels |
| 27 |
Grid topology: |
| 28 |
cellcentre.offset cellsize cells.dim |
| 29 |
x 1 1 4 |
| 30 |
y 1 1 4 |
| 31 |
SpatialPoints: |
| 32 |
x y |
| 33 |
[1,] 1 1 |
| 34 |
[2,] 3 1 |
| 35 |
[3,] 4 1 |
| 36 |
[4,] 1 2 |
| 37 |
[5,] 3 2 |
| 38 |
[6,] 4 2 |
| 39 |
[7,] 1 4 |
| 40 |
[8,] 3 4 |
| 41 |
[9,] 4 4 |
| 42 |
Coordinate Reference System (CRS) arguments: NA |
| 43 |
> # convert to SpatialPixelsDataFrame: |
| 44 |
> tst = SpatialPixelsDataFrame(tst, data.frame(xx = rnorm(9))) |
| 45 |
> spplot(tst["xx"], main = "empty row + col") |
| 46 |
> |
| 47 |
> proc.time() |
| 48 |
user system elapsed |
| 49 |
0.700 0.034 0.729 |