R: Sort a Section

sectionSort {oce} | R Documentation

## Sort a Section

### Description

Sections created with `as.section()` 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.

### Usage

    sectionSort(section, by)

### Arguments

`section` | A `section` object containing the section whose stations are to be sorted.
`by` | An optional string indicating how to reorder. If not provided, `"stationID"` will be assumed. Other choices are `"distance"`, for distance from the first station, `"longitude"`, for longitude, `"latitude"` for latitude, and `"time"`, for time.

### Value

object A section object that has been smoothed, so its data fields will station-to-station variation than is the case for the input section, `x`.

### Author(s)

Dan Kelley

### See Also

Other things related to section data: `[[,section-method`, `[[<-,section-method`, `as.section()`, `handleFlags,section-method`, `initializeFlagScheme,section-method`, `plot,section-method`, `read.section()`, `section-class`, `sectionAddStation()`, `sectionGrid()`, `sectionSmooth()`, `section`, `subset,section-method`, `summary,section-method`

### Examples

    ## Not run:
    # Eastern North Atlantic, showing Mediterranean water;
    # sorting by longitude makes it easier to compare
    # the map and the section.
    library(oce)
    data(section)
    s <- sectionGrid(subset(section, -30 <= longitude))
    ss <- sectionSort(ss, by="longitude")
    plot(ss)

    ## End(Not run)

[Package oce version 1.7-2 Index]