get.sample | R Documentation |
Outputs sample information based on points selected by clicking on a map
get.sample(mat, sample, col.lon, col.lat, ...)
mat |
bathymetric data matrix of class |
sample |
data.frame containing sampling information (at least longitude and latitude) (no default) |
col.lon |
column number of data frame |
col.lat |
column number of data frame |
... |
further arguments to be passed to |
get.sample
allows the user to get sample data by clicking on a map created with plot.bathy
. This function uses the locator
function (graphics
package). After creating a map with plot.bathy
, the user can click twice on the map to delimit an area (for example, lower left and upper right corners of a rectangular area of interest), and get a dataframe corresponding to the sample
points present within the selected area.
a dataframe of the elements of sample
present within the area selected
clicking once or more than twice on the map will return a warning message: "Please choose two points from the map"
Eric Pante
read.bathy
, summary.bathy
, nw.atlantic
, metallo
## Not run:
# load metallo sampling data and add a third field containing a specimen ID
data(metallo)
metallo$id <- factor(paste("Metallo",1:38))
# load NW Atlantic data, convert to class bathy, and plot
data(nw.atlantic)
atl <- as.bathy(nw.atlantic)
plot(atl, deep=-8000, shallow=0, step=1000, col="grey")
# once the map is plotted, use get.sample to get sampling info!
get.sample(atl, metallo, 1, 2)
# click twice
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.