<!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>Establish a Data-Quality Scheme for a oce Object — initializeFlagSchemeInternal • 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="Establish a Data-Quality Scheme for a oce Object — initializeFlagSchemeInternal"><meta name="description" content="This function adds an item named flagScheme
to the metadata slot of an object inheriting from
oce. This is a list containing two
items: name and mapping, as provided in the
function arguments.
The purpose is both to document a flag scheme
and to make it so that initializeFlags(),
setFlags() and handleFlags()
can specify flags by
name, as opposed to number. This is a generic function,
that may be specialized to the class of object
(see &amp;#8220;Details&amp;#8221;)."><meta property="og:description" content="This function adds an item named flagScheme
to the metadata slot of an object inheriting from
oce. This is a list containing two
items: name and mapping, as provided in the
function arguments.
The purpose is both to document a flag scheme
and to make it so that initializeFlags(),
setFlags() and handleFlags()
can specify flags by
name, as opposed to number. This is a generic function,
that may be specialized to the class of object
(see &amp;#8220;Details&amp;#8221;)."></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>Establish a Data-Quality Scheme for a oce Object</h1>
      <small class="dont-index">Source: <a href="https://github.com/dankelley/oce/blob/HEAD/R/AllClass.R" class="external-link"><code>R/AllClass.R</code></a></small>
      <div class="d-none name"><code>initializeFlagSchemeInternal.Rd</code></div>
    </div>

    <div class="ref-description section level2">
    <p>This function adds an item named <code>flagScheme</code>
to the <code>metadata</code> slot of an object inheriting from
<a href="oce-class.html">oce</a>. This is a list containing two
items: <code>name</code> and <code>mapping</code>, as provided in the
function arguments.
The purpose is both to document a flag scheme
and to make it so that <code><a href="initializeFlags.html">initializeFlags()</a></code>,
<code><a href="setFlags.html">setFlags()</a></code> and <code><a href="handleFlags.html">handleFlags()</a></code>
can specify flags by
name, as opposed to number. This is a generic function,
that may be specialized to the class of <code>object</code>
(see “Details”).</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="fu">initializeFlagSchemeInternal</span><span class="op">(</span></span>
<span>  <span class="va">object</span>,</span>
<span>  name <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span>  mapping <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span>  default <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span>  update <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span>  debug <span class="op">=</span> <span class="fl">0</span></span>
<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-object">object<a class="anchor" aria-label="anchor" href="#arg-object"></a></dt>
<dd><p>An oce object.</p></dd>


<dt id="arg-name">name<a class="anchor" aria-label="anchor" href="#arg-name"></a></dt>
<dd><p>a character value naming the scheme. If this refers
to a pre-defined scheme, then <code>mapping</code> must not be provided,
because doing so would contradict the pre-defined scheme, defeating
its purpose of providing concreteness and clarity.</p></dd>


<dt id="arg-mapping">mapping<a class="anchor" aria-label="anchor" href="#arg-mapping"></a></dt>
<dd><p>a list of named items describing the mapping from
flag meaning to flag numerical value, e.g <code>list(good=1, bad=2)</code>
might be used for a hypothetical class.</p></dd>


<dt id="arg-default">default<a class="anchor" aria-label="anchor" href="#arg-default"></a></dt>
<dd><p>an integer vector of flag values that are not considered
to be good. If this is not provided, but if <code>name</code> is <code>"argo"</code>,
<code>"BODC"</code>,
<code>"DFO"</code>,
<code>"WHP bottle"</code>, or
<code>"WHP CTD"</code>, then a conservative value will be set automatically,
equal to the list of flag values that designate bad or questionable data.
For example, for <code>name="WHP CTD"</code>, the setting will be
<code>c(1,3,4,5,6,7,9)</code>, leaving only value <code>2</code>, which corresponds
with "acceptable" in the notation used for that flag scheme.</p></dd>


<dt id="arg-update">update<a class="anchor" aria-label="anchor" href="#arg-update"></a></dt>
<dd><p>a logical value indicating whether the scheme provided is
to update an existing scheme.  The default value, <code>FALSE</code>, prevents such
an attempt to alter an existing flag scheme, if one is already embedded
in <code>object</code>.</p></dd>


<dt id="arg-debug">debug<a class="anchor" aria-label="anchor" href="#arg-debug"></a></dt>
<dd><p>an integer set to 0 for quiet action or to 1 for some debugging.</p></dd>

</dl></div>
    <div class="section level2">
    <h2 id="value">Value<a class="anchor" aria-label="anchor" href="#value"></a></h2>
    <p>An object with the <code>metadata</code> slot containing <code>flagScheme</code>.</p>
    </div>
    <div class="section level2">
    <h2 id="details">Details<a class="anchor" aria-label="anchor" href="#details"></a></h2>
    <p>The following pre-defined schemes are available (note that the
names are simplified from the phrases used in defining
documentation):</p><ul><li><p><code>name="argo"</code> defaults <code>mapping</code> to
OLD (prior to June 10, 2020)</p></li>
</ul><p></p><div class="sourceCode"><pre><code><span id="cb1-1"><a href="#cb1-1" tabindex="-1"></a><span class="fu">list</span>(<span class="at">not_assessed=</span><span class="dv">0</span>, <span class="at">passed_all_tests=</span><span class="dv">1</span>, <span class="at">probably_good=</span><span class="dv">2</span>,</span>
<span id="cb1-2"><a href="#cb1-2" tabindex="-1"></a>     <span class="at">probably_bad=</span><span class="dv">3</span>, <span class="at">bad=</span><span class="dv">4</span>, <span class="at">averaged=</span><span class="dv">7</span>,</span>
<span id="cb1-3"><a href="#cb1-3" tabindex="-1"></a>     <span class="at">interpolated=</span><span class="dv">8</span>, <span class="at">missing=</span><span class="dv">9</span>)</span></code></pre><p></p></div>
<p>NEW (after June 10, 2020)</p>
<p></p><div class="sourceCode"><pre><code><span id="cb1-1"><a href="#cb1-1" tabindex="-1"></a><span class="fu">list</span>(<span class="at">not_assessed=</span><span class="dv">0</span>, <span class="at">passed_all_tests=</span><span class="dv">1</span>, <span class="at">probably_good=</span><span class="dv">2</span>,</span>
<span id="cb1-2"><a href="#cb1-2" tabindex="-1"></a>     <span class="at">probably_bad=</span><span class="dv">3</span>, <span class="at">bad=</span><span class="dv">4</span>, <span class="at">changed=</span><span class="dv">5</span>, <span class="at">not_used_6=</span><span class="dv">6</span>, <span class="at">not_used_7=</span><span class="dv">7</span>,</span>
<span id="cb1-3"><a href="#cb1-3" tabindex="-1"></a>     <span class="at">estimated=</span><span class="dv">8</span>, <span class="at">missing=</span><span class="dv">9</span>)</span></code></pre><p></p></div>
<p>See reference 1 for a deeper explanation of the meanings of these codes.</p><ul><li><p><code>name="BODC"</code> defaults <code>mapping</code> to</p></li>
</ul><p></p><div class="sourceCode"><pre><code><span id="cb1-1"><a href="#cb1-1" tabindex="-1"></a><span class="fu">list</span>(<span class="at">no_quality_control=</span><span class="dv">0</span>, <span class="at">good=</span><span class="dv">1</span>, <span class="at">probably_good=</span><span class="dv">2</span>,</span>
<span id="cb1-2"><a href="#cb1-2" tabindex="-1"></a>     <span class="at">probably_bad=</span><span class="dv">3</span>, <span class="at">bad=</span><span class="dv">4</span>, <span class="at">changed=</span><span class="dv">5</span>,</span>
<span id="cb1-3"><a href="#cb1-3" tabindex="-1"></a>     <span class="at">below_detection=</span><span class="dv">6</span>, <span class="at">in_excess=</span><span class="dv">7</span>, <span class="at">interpolated=</span><span class="dv">8</span>,</span>
<span id="cb1-4"><a href="#cb1-4" tabindex="-1"></a>     <span class="at">missing=</span><span class="dv">9</span>)</span></code></pre><p></p></div>
<p>See reference 2 for a deeper explanation of the meanings of these codes,
and note that codes <code>A</code> and <code>Q</code> are not provided in
oce.</p><ul><li><p><code>name="DFO"</code> defaults <code>mapping</code> to</p></li>
</ul><p></p><div class="sourceCode"><pre><code><span id="cb1-1"><a href="#cb1-1" tabindex="-1"></a><span class="fu">list</span>(<span class="at">no_quality_control=</span><span class="dv">0</span>, <span class="at">appears_correct=</span><span class="dv">1</span>, <span class="at">appears_inconsistent=</span><span class="dv">2</span>,</span>
<span id="cb1-2"><a href="#cb1-2" tabindex="-1"></a>     <span class="at">doubtful=</span><span class="dv">3</span>, <span class="at">erroneous=</span><span class="dv">4</span>, <span class="at">changed=</span><span class="dv">5</span>,</span>
<span id="cb1-3"><a href="#cb1-3" tabindex="-1"></a>     <span class="at">qc_by_originator=</span><span class="dv">8</span>, <span class="at">missing=</span><span class="dv">9</span>)</span></code></pre><p></p></div>
<p>See reference 3 for a deeper explanation of the meanings of these codes.</p><ul><li><p><code>name="WHP bottle"</code> defaults <code>mapping</code> to</p></li>
</ul><p></p><div class="sourceCode"><pre><code><span id="cb1-1"><a href="#cb1-1" tabindex="-1"></a><span class="fu">list</span>(<span class="at">no_information=</span><span class="dv">1</span>, <span class="at">no_problems_noted=</span><span class="dv">2</span>, <span class="at">leaking=</span><span class="dv">3</span>,</span>
<span id="cb1-2"><a href="#cb1-2" tabindex="-1"></a>     <span class="at">did_not_trip=</span><span class="dv">4</span>, <span class="at">not_reported=</span><span class="dv">5</span>, <span class="at">discrepency=</span><span class="dv">6</span>,</span>
<span id="cb1-3"><a href="#cb1-3" tabindex="-1"></a>     <span class="at">unknown_problem=</span><span class="dv">7</span>, <span class="at">did_not_trip=</span><span class="dv">8</span>, <span class="at">no_sample=</span><span class="dv">9</span>)</span></code></pre><p></p></div>
<p>See reference 4 for a deeper explanation of the meanings of these codes.</p><ul><li><p><code>name="WHP CTD"</code> defaults <code>mapping</code> to</p></li>
</ul><p></p><div class="sourceCode"><pre><code><span id="cb1-1"><a href="#cb1-1" tabindex="-1"></a><span class="fu">list</span>(<span class="at">not_calibrated=</span><span class="dv">1</span>, <span class="at">acceptable=</span><span class="dv">2</span>, <span class="at">questionable=</span><span class="dv">3</span>,</span>
<span id="cb1-2"><a href="#cb1-2" tabindex="-1"></a>    <span class="at">bad=</span><span class="dv">4</span>, <span class="at">not_reported=</span><span class="dv">5</span>, <span class="at">interpolated=</span><span class="dv">6</span>,</span>
<span id="cb1-3"><a href="#cb1-3" tabindex="-1"></a>    <span class="at">despiked=</span><span class="dv">7</span>, <span class="at">missing=</span><span class="dv">9</span>)</span></code></pre><p></p></div>
<p>See reference 4 for a deeper explanation of the meanings of these codes.</p>
    </div>
    <div class="section level2">
    <h2 id="references">References<a class="anchor" aria-label="anchor" href="#references"></a></h2>

<ol><li><p>The codes for <code>"argo"</code> are derived from information in Table 4.1
of Wong, Annie, Robert Keeley, Thierry Carval, and Argo Data Management Team
(8 January 2020), "Argo Quality Control Manual for CTD and Trajectory Data, Version 3.3,"
available at <code>https://archimer.ifremer.fr/doc/00228/33951/</code>
as of June 2020.</p></li>
<li><p>The codes for <code>"BODC"</code> are defined at
http://seadatanet.maris2.nl/v_bodc_vocab_v2/browse.asp?order=conceptid&amp;formname=search&amp;screen=0&amp;lib=l20</p></li>
<li><p>The codes for <code>"DFO"</code> are defined at
http://www.dfo-mpo.gc.ca/science/data-donnees/code/list/014-eng.html</p></li>
<li><p>The codes for <code>"WHP CTD"</code> and <code>"WHP bottle"</code> are defined at
https://www.nodc.noaa.gov/woce/woce_v3/wocedata_1/whp/exchange/exchange_format_desc.htm</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 relating to data-quality flags:
<code><a href="defaultFlags.html">defaultFlags</a>()</code>,
<code><a href="handleFlags.html">handleFlags</a>()</code>,
<code><a href="handleFlags-adp-method.html">handleFlags,adp-method</a></code>,
<code><a href="handleFlags-argo-method.html">handleFlags,argo-method</a></code>,
<code><a href="handleFlags-ctd-method.html">handleFlags,ctd-method</a></code>,
<code><a href="handleFlags-oce-method.html">handleFlags,oce-method</a></code>,
<code><a href="handleFlags-section-method.html">handleFlags,section-method</a></code>,
<code><a href="initializeFlagScheme.html">initializeFlagScheme</a>()</code>,
<code><a href="initializeFlagScheme-ctd-method.html">initializeFlagScheme,ctd-method</a></code>,
<code><a href="initializeFlagScheme-oce-method.html">initializeFlagScheme,oce-method</a></code>,
<code><a href="initializeFlagScheme-section-method.html">initializeFlagScheme,section-method</a></code>,
<code><a href="initializeFlags.html">initializeFlags</a>()</code>,
<code><a href="initializeFlags-adp-method.html">initializeFlags,adp-method</a></code>,
<code><a href="initializeFlags-oce-method.html">initializeFlags,oce-method</a></code>,
<code><a href="initializeFlagsInternal.html">initializeFlagsInternal</a>()</code>,
<code><a href="setFlags.html">setFlags</a>()</code>,
<code><a href="setFlags-adp-method.html">setFlags,adp-method</a></code>,
<code><a href="setFlags-ctd-method.html">setFlags,ctd-method</a></code>,
<code><a href="setFlags-oce-method.html">setFlags,oce-method</a></code></p>
<p>Other things related to oce data:
<code><a href="initializeFlagScheme.html">initializeFlagScheme</a>()</code>,
<code><a href="initializeFlagScheme-oce-method.html">initializeFlagScheme,oce-method</a></code></p></div>
    </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>

