<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><title>Extract Something From an echosounder Object — [[,echosounder-method • oce</title><script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/font-awesome-6.4.2/css/all.min.css" rel="stylesheet"><link href="../deps/font-awesome-6.4.2/css/v4-shims.min.css" rel="stylesheet"><script src="../deps/headroom-0.11.0/headroom.min.js"></script><script src="../deps/headroom-0.11.0/jQuery.headroom.min.js"></script><script src="../deps/bootstrap-toc-1.0.1/bootstrap-toc.min.js"></script><script src="../deps/clipboard.js-2.0.11/clipboard.min.js"></script><script src="../deps/search-1.0.0/autocomplete.jquery.min.js"></script><script src="../deps/search-1.0.0/fuse.min.js"></script><script src="../deps/search-1.0.0/mark.min.js"></script><!-- pkgdown --><script src="../pkgdown.js"></script><meta property="og:title" content="Extract Something From an echosounder Object — [[,echosounder-method"><meta name="description" content="Generally, the [[ method lets users extract information from oce
objects, without having to know the details of the internal storage.  For
many oce sub-classes, [[ can also return quantities that are computed
from the object's contents."><meta property="og:description" content="Generally, the [[ method lets users extract information from oce
objects, without having to know the details of the internal storage.  For
many oce sub-classes, [[ can also return quantities that are computed
from the object's contents."></head><body>
    <a href="#main" class="visually-hidden-focusable">Skip to contents</a>


    <nav class="navbar navbar-expand-lg fixed-top bg-light" data-bs-theme="light" aria-label="Site navigation"><div class="container">

    <a class="navbar-brand me-2" href="../index.html">oce</a>

    <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="">1.8-4</small>


    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>

    <div id="navbar" class="collapse navbar-collapse ms-3">
      <ul class="navbar-nav me-auto"><li class="active nav-item"><a class="nav-link" href="../reference/index.html">Reference</a></li>
<li class="nav-item dropdown">
  <button class="nav-link dropdown-toggle" type="button" id="dropdown-articles" data-bs-toggle="dropdown" aria-expanded="false" aria-haspopup="true">Articles</button>
  <ul class="dropdown-menu" aria-labelledby="dropdown-articles"><li><a class="dropdown-item" href="../articles/A_oce.html">1. Introduction to Oce</a></li>
    <li><a class="dropdown-item" href="../articles/B_ctd.html">2. Analysis of CTD data</a></li>
    <li><a class="dropdown-item" href="../articles/C_adp.html">3. Analysis of acoustic-Doppler data</a></li>
    <li><a class="dropdown-item" href="../articles/D_map_projections.html">4. Using map projections</a></li>
    <li><a class="dropdown-item" href="../articles/E_flags.html">5. Dealing with data-quality flags</a></li>
    <li><a class="dropdown-item" href="../articles/F_subclassing.html">6. Subclassing oce objects</a></li>
    <li><a class="dropdown-item" href="../articles/G_altering_defaults.html">7. Altering oce Defaults</a></li>
    <li><a class="dropdown-item" href="../articles/H_tides.html">8. Tidal Analysis</a></li>
  </ul></li>
<li class="nav-item"><a class="nav-link" href="../news/index.html">Changelog</a></li>
      </ul><ul class="navbar-nav"><li class="nav-item"><form class="form-inline" role="search">
 <input class="form-control" type="search" name="search-input" id="search-input" autocomplete="off" aria-label="Search site" placeholder="Search for" data-search-index="../search.json"></form></li>
<li class="nav-item"><a class="external-link nav-link" href="https://github.com/dankelley/oce/" aria-label="GitHub"><span class="fa fab fa-github fa-lg"></span></a></li>
      </ul></div>


  </div>
</nav><div class="container template-reference-topic">
<div class="row">
  <main id="main" class="col-md-9"><div class="page-header">

      <h1>Extract Something From an echosounder Object</h1>
      <small class="dont-index">Source: <a href="https://github.com/dankelley/oce/blob/HEAD/R/echosounder.R" class="external-link"><code>R/echosounder.R</code></a></small>
      <div class="d-none name"><code>sub-sub-echosounder-method.Rd</code></div>
    </div>

    <div class="ref-description section level2">
    <p>Generally, the <code>[[</code> method lets users extract information from <code>oce</code>
objects, without having to know the details of the internal storage.  For
many <code>oce</code> sub-classes, <code>[[</code> can also return quantities that are computed
from the object's contents.</p>
    </div>

    <div class="section level2">
    <h2 id="ref-usage">Usage<a class="anchor" aria-label="anchor" href="#ref-usage"></a></h2>
    <div class="sourceCode"><pre class="sourceCode r"><code><span><span class="co"># S4 method for class 'echosounder'</span></span>
<span><span class="va">x</span><span class="op">[[</span><span class="va">i</span>, <span class="va">j</span>, <span class="va">...</span><span class="op">]</span><span class="op">]</span></span></code></pre></div>
    </div>

    <div class="section level2">
    <h2 id="arguments">Arguments<a class="anchor" aria-label="anchor" href="#arguments"></a></h2>


<dl><dt id="arg-x">x<a class="anchor" aria-label="anchor" href="#arg-x"></a></dt>
<dd><p>an <a href="echosounder-class.html">echosounder</a> object.</p></dd>


<dt id="arg-i">i<a class="anchor" aria-label="anchor" href="#arg-i"></a></dt>
<dd><p>character value indicating the name of an item to extract.</p></dd>


<dt id="arg-j">j<a class="anchor" aria-label="anchor" href="#arg-j"></a></dt>
<dd><p>optional additional information on the <code>i</code> item.</p></dd>


<dt id="arg--">...<a class="anchor" aria-label="anchor" href="#arg--"></a></dt>
<dd><p>ignored.</p></dd>

</dl></div>
    <div class="section level2">
    <h2 id="details">Details<a class="anchor" aria-label="anchor" href="#details"></a></h2>
    <p>A two-step process is used to try to find the requested information. First, a
class-specific function is used (see “Details of the Specialized
Method”).  If this yields nothing, then a general method is used (see
“Details of the General Method”).  If both methods fail, then <code>[[</code>
returns NULL.</p>
<p>Some understanding of the subclass is required to know what can be retrieved
with <code>[[</code>. When dealing with an unfamiliar subclass, it can be useful to
first use <code>x[["?"]]</code> to get a listing of the retrievable items. See
“Details of the Specialized Method” for more information.</p>
    </div>
    <div class="section level2">
    <h2 id="details-of-the-specialized-method">Details of the Specialized Method<a class="anchor" aria-label="anchor" href="#details-of-the-specialized-method"></a></h2>


<ul><li><p>If <code>i</code> is <code>"?"</code>, then the return value is a list
containing four items, each of which is a character vector
holding the names of things that can be accessed with <code>[[</code>.
The <code>data</code> and <code>metadata</code> items hold the names of
entries in the object's data and metadata
slots, respectively. The <code>metadataDerived</code> item
is NULL, while the <code>dataDerived</code> item holds
<code>"Sv"</code> and <code>"TS"</code> (see next).</p></li>
<li><p>If <code>i</code> is <code>"Sv"</code>, then the following is returned.</p><div class="sourceCode"><pre><code><span></span>
<span><span class="fl">20</span><span class="op">*</span><span class="fu"><a href="https://rdrr.io/r/base/Log.html" class="external-link">log10</a></span><span class="op">(</span><span class="va">a</span><span class="op">)</span> <span class="op">-</span></span>
<span>  <span class="op">(</span><span class="va">x</span><span class="op">@</span><span class="va">metadata</span><span class="op">$</span><span class="va">sourceLevel</span><span class="op">+</span><span class="va">x</span><span class="op">@</span><span class="va">metadata</span><span class="op">$</span><span class="va">receiverSensitivity</span><span class="op">+</span><span class="va">x</span><span class="op">@</span><span class="va">metadata</span><span class="op">$</span><span class="va">transmitPower</span><span class="op">)</span> <span class="op">+</span></span>
<span>  <span class="fl">20</span><span class="op">*</span><span class="fu"><a href="https://rdrr.io/r/base/Log.html" class="external-link">log10</a></span><span class="op">(</span><span class="va">r</span><span class="op">)</span> <span class="op">+</span></span>
<span>  <span class="fl">2</span><span class="op">*</span><span class="va">absorption</span><span class="op">*</span><span class="va">r</span> <span class="op">-</span></span>
<span>  <span class="va">x</span><span class="op">@</span><span class="va">metadata</span><span class="op">$</span><span class="va">correction</span> <span class="op">+</span></span>
<span>  <span class="fl">10</span><span class="op">*</span><span class="fu"><a href="https://rdrr.io/r/base/Log.html" class="external-link">log10</a></span><span class="op">(</span><span class="va">soundSpeed</span><span class="op">*</span><span class="va">x</span><span class="op">@</span><span class="va">metadata</span><span class="op">$</span><span class="va">pulseDuration</span><span class="op">/</span><span class="fl">1e6</span><span class="op">*</span><span class="va">psi</span><span class="op">/</span><span class="fl">2</span><span class="op">)</span></span></code></pre></div></li>
<li><p>If <code>i</code> is <code>"TS"</code>, then the following is returned.</p><div class="sourceCode"><pre><code><span></span>
<span><span class="fl">20</span><span class="op">*</span><span class="fu"><a href="https://rdrr.io/r/base/Log.html" class="external-link">log10</a></span><span class="op">(</span><span class="va">a</span><span class="op">)</span> <span class="op">-</span></span>
<span>  <span class="op">(</span><span class="va">x</span><span class="op">@</span><span class="va">metadata</span><span class="op">$</span><span class="va">sourceLevel</span><span class="op">+</span><span class="va">x</span><span class="op">@</span><span class="va">metadata</span><span class="op">$</span><span class="va">receiverSensitivity</span><span class="op">+</span><span class="va">x</span><span class="op">@</span><span class="va">metadata</span><span class="op">$</span><span class="va">transmitPower</span><span class="op">)</span> <span class="op">+</span></span>
<span>  <span class="fl">40</span><span class="op">*</span><span class="fu"><a href="https://rdrr.io/r/base/Log.html" class="external-link">log10</a></span><span class="op">(</span><span class="va">r</span><span class="op">)</span> <span class="op">+</span></span>
<span>  <span class="fl">2</span><span class="op">*</span><span class="va">absorption</span><span class="op">*</span><span class="va">r</span> <span class="op">+</span></span>
<span>  <span class="va">x</span><span class="op">@</span><span class="va">metadata</span><span class="op">$</span><span class="va">correction</span></span></code></pre></div></li>
</ul></div>
    <div class="section level2">
    <h2 id="details-of-the-general-method">Details of the General Method<a class="anchor" aria-label="anchor" href="#details-of-the-general-method"></a></h2>



<p>Note: the text of this section is identical for all <code>oce</code> subclasses, and so
some of what you read here may not be relevant to the class being described
in this help page.</p>
<p>If the specialized method produces no matches, the following generalized
method is applied. As with the specialized method, the procedure hinges first
on the values of <code>i</code> and, optionally, <code>j</code>. The work proceeds in steps, by
testing a sequence of possible conditions in sequence.</p><ol><li><p>A check is made as to whether <code>i</code> names one of the standard <code>oce</code> slots.
If so, <code>[[</code> returns the slot contents of that slot.  Thus, <code>x[["metadata"]]</code>
will retrieve the <code>metadata</code> slot, while <code>x[["data"]]</code> and
<code>x[["processingLog"]]</code> return those slots.</p></li>
<li><p>If <code>i</code> is a string ending in the <code>"Unit"</code>, then the characters preceding
that string are taken to be the name of an item in the data object, and a
list containing the unit is returned (or <code>NULL</code> if there is no such unit).
This list consists of an item named <code>unit</code>, which is an <code><a href="https://rdrr.io/r/base/expression.html" class="external-link">expression()</a></code>, and
an item named <code>scale</code>, which is a string describing the measurement scale.
If the string ends in <code>" unit"</code>, e.g.  <code>x[["temperature unit"]]</code> (note the
space), then just the expression is returned, and if it ends in <code>" scale"</code>,
then just the scale is returned.</p></li>
<li><p>If <code>i</code> is a string ending in <code>"Flag"</code>, then the corresponding data-quality
flag is returned (or <code>NULL</code> if there is no such flag).</p></li>
<li><p>If the object holds hydrographic information (pressure, salinity,
temperature, longitude and latitude) then another set of possibilities
arises.  If <code>i</code> is <code>"sigmaTheta"</code>, then the value of <code><a href="swSigmaTheta.html">swSigmaTheta()</a></code> is
called with <code>x</code> as the sole argument, and the results are returned.
Similarly, <code><a href="swSigma0.html">swSigma0()</a></code> is used if <code>i="sigma0"</code>, and <code><a href="swSpice.html">swSpice()</a></code> is used if
<code>i="spice"</code>. Of course, these actions only make sense for objects that
contain the relevant items within their <code>data</code> slot.</p></li>
<li><p>After these possibilities are eliminated, the action depends on whether
<code>j</code> has been provided.  If <code>j</code> is not provided, or is the string <code>""</code>, then
<code>i</code> is sought in the <code>metadata</code> slot, and then in the <code>data</code> slot, returning
whichever is found first.  In other words, if <code>j</code> is not provided, the
<code>metadata</code> slot takes preference over the <code>data</code> slot. However, if <code>j</code> is
provided, then it must be either the string <code>"metadata"</code> or <code>"data"</code>, and it
directs where to look.</p></li>
<li><p>If none of the above-listed conditions holds, then <code>NULL</code> is returned.</p></li>
</ol></div>
    <div class="section level2">
    <h2 id="see-also">See also<a class="anchor" aria-label="anchor" href="#see-also"></a></h2>
    <div class="dont-index"><p>Other functions that extract parts of oce objects:
<code><a href="sub-sub-adp-method.html">[[,adp-method</a></code>,
<code><a href="sub-sub-adv-method.html">[[,adv-method</a></code>,
<code><a href="sub-sub-amsr-method.html">[[,amsr-method</a></code>,
<code><a href="sub-sub-argo-method.html">[[,argo-method</a></code>,
<code><a href="sub-sub-bremen-method.html">[[,bremen-method</a></code>,
<code><a href="sub-sub-cm-method.html">[[,cm-method</a></code>,
<code><a href="sub-sub-coastline-method.html">[[,coastline-method</a></code>,
<code><a href="sub-sub-ctd-method.html">[[,ctd-method</a></code>,
<code><a href="sub-sub-g1sst-method.html">[[,g1sst-method</a></code>,
<code><a href="sub-sub-gps-method.html">[[,gps-method</a></code>,
<code><a href="sub-sub-ladp-method.html">[[,ladp-method</a></code>,
<code><a href="sub-sub-landsat-method.html">[[,landsat-method</a></code>,
<code><a href="sub-sub-lisst-method.html">[[,lisst-method</a></code>,
<code><a href="sub-sub-lobo-method.html">[[,lobo-method</a></code>,
<code><a href="sub-sub-met-method.html">[[,met-method</a></code>,
<code><a href="sub-sub-oce-method.html">[[,oce-method</a></code>,
<code><a href="sub-sub-odf-method.html">[[,odf-method</a></code>,
<code><a href="sub-sub-rsk-method.html">[[,rsk-method</a></code>,
<code><a href="sub-sub-sealevel-method.html">[[,sealevel-method</a></code>,
<code><a href="sub-sub-section-method.html">[[,section-method</a></code>,
<code><a href="sub-sub-tidem-method.html">[[,tidem-method</a></code>,
<code><a href="sub-sub-topo-method.html">[[,topo-method</a></code>,
<code><a href="sub-sub-windrose-method.html">[[,windrose-method</a></code>,
<code><a href="sub-sub-xbt-method.html">[[,xbt-method</a></code>,
<code>[[&lt;-,adv-method</code></p>
<p>Other things related to echosounder data:
<code>[[&lt;-,echosounder-method</code>,
<code><a href="as.echosounder.html">as.echosounder</a>()</code>,
<code><a href="echosounder.html">echosounder</a></code>,
<code><a href="echosounder-class.html">echosounder-class</a></code>,
<code><a href="findBottom.html">findBottom</a>()</code>,
<code><a href="plot-echosounder-method.html">plot,echosounder-method</a></code>,
<code><a href="read.echosounder.html">read.echosounder</a>()</code>,
<code><a href="subset-echosounder-method.html">subset,echosounder-method</a></code>,
<code><a href="summary-echosounder-method.html">summary,echosounder-method</a></code></p></div>
    </div>
    <div class="section level2">
    <h2 id="author">Author<a class="anchor" aria-label="anchor" href="#author"></a></h2>
    <p>Dan Kelley</p>
    </div>

  </main><aside class="col-md-3"><nav id="toc" aria-label="Table of contents"><h2>On this page</h2>
    </nav></aside></div>


    <footer><div class="pkgdown-footer-left">
  <p>Developed by Dan Kelley, Clark Richards.</p>
</div>

<div class="pkgdown-footer-right">
  <p>Site built with <a href="https://pkgdown.r-lib.org/" class="external-link">pkgdown</a> 2.1.0.9000.</p>
</div>

    </footer></div>





  </body></html>

