Learn R Programming

oce (version 0.2-1)

sectionSort: Sort a section

Description

Sort a section

Usage

sectionSort(section, by=c("stationId", "distance"))

Arguments

section
a section object containing the section whose stations are to be sorted
by
a string indicating how to reorder. Note that the "distance" method does not yet work ... also, eventually there will be other possibilities, e.g. "latitude".

Value

  • An object of class "section" that has less lateral variation than the input section.

Details

Sections created with makeSection have "stations" that are in the order of the CTD objects (or filenames for such objects) provided. Sometimes, this is not the desired order, e.g. if file names discovered with dir are in an order that makes no sense. (For example, a practioner might name stations "stn1", "stn2", etc., not realizing that this will yield an unhelpful ordering, by file name, if there are more than 9 stations.)

The purpose of sectionSort is to permit reordering the constituent stations in sensible ways.

See Also

Sections are normally created with read.section or makeSection. subset may be used to create a new section consisting of just a subset of an existing station, e.g. to focus on a particular region.

Examples

Run this code
# Eastern North Atlantic, showing Mediterranean water. 
library(oce)
data(coastlineWorld)
data(a03)
s <- sectionGrid(subset(a03, indices=90:3), p=seq(00, 2500, 100))
ss <- sectionSort(s, by="stationId")
plot(ss,coastline=coastlineWorld,map.xlim=c(-75,0))

Run the code above in your browser using DataLab