subset,coastline-method | R Documentation |
Subsets a coastline object according to limiting values for longitude and latitude.
## S4 method for signature 'coastline'
subset(x, subset, ...)
x |
a coastline object. |
subset |
An expression indicating how to subset |
... |
optional additional arguments, the only one of which is considered
is one named |
As illustrated in the “Examples”, subset
must be an expression that
indicates limits on both latitude
and longitude
. The individual elements
are provided in R notation, not mathematical notation, i.e. 30<latitude<60
is not permitted and ought to be written 30 < latitude & latitude < 60
. The
simplest way to understand this is to copy the example directly, and then
modify the stated limits. Note that >
comparison is not permitted, and that
<
is converted to <=
in the calculation. Similarly, &&
is converted to
&
. Spaces in the expression are ignored. For convenience, longitude
and
and latitude
may be abbreviated as lon
and lat
, as in the
“Examples”.
A coastline
object.
Dan Kelley
Other things related to coastline data:
[[,coastline-method
,
[[<-,coastline-method
,
as.coastline()
,
coastline-class
,
coastlineBest()
,
coastlineCut()
,
coastlineWorld
,
download.coastline()
,
plot,coastline-method
,
read.coastline.openstreetmap()
,
read.coastline.shapefile()
,
summary,coastline-method
Other functions that subset oce objects:
subset,adp-method
,
subset,adv-method
,
subset,amsr-method
,
subset,argo-method
,
subset,cm-method
,
subset,ctd-method
,
subset,echosounder-method
,
subset,lobo-method
,
subset,met-method
,
subset,oce-method
,
subset,odf-method
,
subset,rsk-method
,
subset,sealevel-method
,
subset,section-method
,
subset,topo-method
,
subset,xbt-method
library(oce)
data(coastlineWorld)
# Subset to a box centred on Nova Scotia, Canada
if (requireNamespace("sf")) {
cl <- subset(coastlineWorld, -80 < lon & lon <- 50 & 30 < lat & lat < 60)
# The plot demonstrates that the trimming is as requested.
plot(cl, clon = -65, clat = 45, span = 6000)
rect(-80, 30, -50, 60, bg = "transparent", border = "red")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.