/usr/share/doc/r-cran-sp/tests/base.R is in r-cran-sp 1:1.2-4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | library(sp)
data(meuse)
x = meuse[1:10, ] # limit the output
coordinates(x) = c("x", "y") # names
bbox(x)
is.projected(x)
dimensions(x)
x
x = meuse[1:10, ]
coordinates(x) = c(1, 2) # coordinate column numbers
x
x = meuse[1:10, ]
coordinates(x) = ~x+y # coordinates formula
x
x = meuse[1:10, ]
coordinates(x) = meuse[1:10, c("x", "y")] # coords, as data.frame
x
x = meuse[1:10, ]
coordinates(x) = as.matrix(meuse[1:10, c("x", "y")]) # coords, as matrix
x
x = meuse[1:20,]
coordinates(x) = c("x", "y") # coordinate column names
print(summary(x))
x[1:10] # first 10 columns
x[, 1:10] # first 10 columns
x[1:10,] # rows 1-10
x["zinc"] # column zinc + coords
x[, "zinc"] # idem
x[1:10, "zinc"] # idem
x[1:10, c("zinc", "cadmium")] # idem
x[["zinc"]]
x[["lnzinc"]] <- log(x[["zinc"]])
x
print(summary(x[1:10, "zinc"])) # check bbox
print(summary(x["zinc"])) # compare bbox
data(meuse.grid)
coordinates(meuse.grid) = ~x+y
gridded(meuse.grid) = TRUE
plot(meuse.grid)
|