<!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"><meta name="description" content="This computes a vector that contains the relative weight specific to each species for all individuals in an entire data frame."><title>Computes a vector of relative weights specific to a species in an entire data frame. — wrAdd • FSA</title><!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png"><link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png"><link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../apple-touch-icon.png"><link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png"><link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png"><link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png"><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.2.2/bootstrap.min.css" rel="stylesheet"><script src="../deps/bootstrap-5.2.2/bootstrap.bundle.min.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous"><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous"><!-- bootstrap-toc --><script src="https://cdn.jsdelivr.net/gh/afeld/bootstrap-toc@v1.0.1/dist/bootstrap-toc.min.js" integrity="sha256-4veVQbu7//Lk5TSmc7YV48MxtMy98e26cf5MrgZYnwo=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- search --><script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/6.4.6/fuse.js" integrity="sha512-zv6Ywkjyktsohkbp9bb45V6tEMoWhzFzXis+LrMehmJZZSys19Yxf1dopHx7WzIKxr5tK2dVcYmaCk2uqdjF4A==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/autocomplete.js/0.38.0/autocomplete.jquery.min.js" integrity="sha512-GU9ayf+66Xx2TmpxqJpliWbT5PiGYxpaG8rfnBEk1LL8l1KGkRShhngwdXK1UgqhAzWpZHSiYPc09/NwDQIGyg==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/mark.min.js" integrity="sha512-5CYOlHXGh6QpOFA/TeTylKLWfB3ftPsde7AnmhuitiTX4K5SqCLBeKro6sPS8ilsz1Q4NRx3v8Ko2IBiszzdww==" crossorigin="anonymous"></script><!-- pkgdown --><script src="../pkgdown.js"></script><meta property="og:title" content="Computes a vector of relative weights specific to a species in an entire data frame. — wrAdd"><meta property="og:description" content="This computes a vector that contains the relative weight specific to each species for all individuals in an entire data frame."><meta property="og:image" content="https://fishr-core-team.github.io/FSA/logo.png"><!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]--></head><body>
    <a href="#main" class="visually-hidden-focusable">Skip to contents</a>
    

    <nav class="navbar fixed-top navbar-dark navbar-expand-lg bg-primary"><div class="container">
    
    <a class="navbar-brand me-2" href="../index.html">FSA</a>

    <small class="nav-text text-muted me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Released version">0.9.5</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>
      </ul><form class="form-inline my-2 my-lg-0" role="search">
        <input type="search" class="form-control me-sm-2" aria-label="Toggle navigation" name="search-input" data-search-index="../search.json" id="search-input" placeholder="Search for" autocomplete="off"></form>

      <ul class="navbar-nav"><li class="nav-item">
  <a class="nav-link" href="../news/index.html">
    <span class="fa fa-newspaper"></span>
     
  </a>
</li>
<li class="nav-item">
  <a class="nav-link" href="../index.html">
    <span class="fa fa-home fa"></span>
     
  </a>
</li>
<li class="nav-item">
  <a class="external-link nav-link" href="https://github.com/fishR-Core-Team/FSA">
    <span class="fa fa-github fa"></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">
      <img src="../logo.png" class="logo" alt=""><h1>Computes a vector of relative weights specific to a species in an entire data frame.</h1>
      <small class="dont-index">Source: <a href="https://github.com/fishR-Core-Team/FSA/blob/HEAD/R/wrAdd.R" class="external-link"><code>R/wrAdd.R</code></a></small>
      <div class="d-none name"><code>wrAdd.Rd</code></div>
    </div>

    <div class="ref-description section level2">
    <p>This computes a vector that contains the relative weight specific to each species for all individuals in an entire data frame.</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">wrAdd</span><span class="op">(</span><span class="va">wt</span>, <span class="va">...</span><span class="op">)</span></span>
<span></span>
<span><span class="co"># S3 method for default</span></span>
<span><span class="fu">wrAdd</span><span class="op">(</span><span class="va">wt</span>, <span class="va">len</span>, <span class="va">spec</span>, units <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"metric"</span>, <span class="st">"English"</span><span class="op">)</span>, <span class="va">...</span><span class="op">)</span></span>
<span></span>
<span><span class="co"># S3 method for formula</span></span>
<span><span class="fu">wrAdd</span><span class="op">(</span><span class="va">wt</span>, <span class="va">data</span>, units <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"metric"</span>, <span class="st">"English"</span><span class="op">)</span>, <span class="va">...</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>wt</dt>
<dd><p>A numeric vector that contains weight measurements or a formula of the form <code>wt~len+spec</code> where “wt” generically represents the weight variable, “len” generically represents the length variable, and “spec” generically represents the species variable. Note that this formula can only contain three variables and they must be in the order of weight first, length second, species third.</p></dd>


<dt>...</dt>
<dd><p>Not used.</p></dd>


<dt>len</dt>
<dd><p>A numeric vector that contains length measurements. Not used if <code>wt</code> is a formula.</p></dd>


<dt>spec</dt>
<dd><p>A character or factor vector that contains the species names. Not used if <code>wt</code> is a formula.</p></dd>


<dt>units</dt>
<dd><p>A string that indicates whether the weight and length data in <code>formula</code> are in (<code>"metric"</code> (DEFAULT; mm and g) or <code>"English"</code> (in and lbs) units.</p></dd>


<dt>data</dt>
<dd><p>A data.frame that minimally contains variables of the the observed lengths, observed weights, and the species names given in the <code>formula=</code>.</p></dd>

</dl></div>
    <div class="section level2">
    <h2 id="value">Value<a class="anchor" aria-label="anchor" href="#value"></a></h2>
    

<p>Returns A numeric vector that contains the computed relative weights, in the same order as in <code>data=</code>.</p>
    </div>
    <div class="section level2">
    <h2 id="details">Details<a class="anchor" aria-label="anchor" href="#details"></a></h2>
    <p>This computes a vector that contains the relative weight specific to each species for all individuals in an entire data frame. The vector can be appended to an existing data.frame to create a variable that contains the relative weights for each individual. The relative weight value will be <code>NA</code> for each individual for which a standard weight equation does not exist in <code><a href="WSlit.html">WSlit</a></code>, a standard weight equation for the units given in <code>units=</code> does not exist in <code><a href="WSlit.html">WSlit</a></code>, a standard weight equation for the 75th percentile does not exist in <code><a href="WSlit.html">WSlit</a></code>, or if the individual is shorter or longer than the lengths for which the standard weight equation should be applied. Either the linear or quadratic equation has been listed as preferred for each species, so only that equation will be used. The use of the 75th percentile is by far the most common and, because this function is designed for use on entire data frames, it will be the only percentile allowed. Thus, to use equations for other percentiles, one will have to use “manual” methods. See <code><a href="WSlit.html">WSlit</a></code> and <code><a href="wsVal.html">wsVal</a></code> for more details about types of equations, percentiles, finding which species have published standard weight equations, etc. See the examples for one method for changing species names to something that this function will recognize.</p>
    </div>
    <div class="section level2">
    <h2 id="ifar-chapter">IFAR Chapter<a class="anchor" aria-label="anchor" href="#ifar-chapter"></a></h2>
    <p>8-Condition.</p>
    </div>
    <div class="section level2">
    <h2 id="references">References<a class="anchor" aria-label="anchor" href="#references"></a></h2>
    <p>Ogle, D.H. 2016. <a href="https://fishr-core-team.github.io/fishR/pages/books.html#introductory-fisheries-analyses-with-r" class="external-link">Introductory Fisheries Analyses with R</a>. Chapman &amp; Hall/CRC, Boca Raton, FL.</p>
    </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>See <code><a href="wsVal.html">wsVal</a></code>, <code><a href="WSlit.html">WSlit</a></code>, and <code><a href="psdAdd.html">psdAdd</a></code> for related functionality. See <code><a href="https://rdrr.io/pkg/plyr/man/mapvalues.html" class="external-link">mapvalues</a></code> for help in changing species names to match those in <code><a href="WSlit.html">WSlit</a></code>.</p></div>
    </div>
    <div class="section level2">
    <h2 id="author">Author<a class="anchor" aria-label="anchor" href="#author"></a></h2>
    <p>Derek H. Ogle, <a href="mailto:DerekOgle51@gmail.com">DerekOgle51@gmail.com</a></p>
    </div>

    <div class="section level2">
    <h2 id="ref-examples">Examples<a class="anchor" aria-label="anchor" href="#ref-examples"></a></h2>
    <div class="sourceCode"><pre class="sourceCode r"><code><span class="r-in"><span><span class="co">## Create random data for three species</span></span></span>
<span class="r-in"><span><span class="co"># just to control the randomization</span></span></span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/base/Random.html" class="external-link">set.seed</a></span><span class="op">(</span><span class="fl">345234534</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">dbt</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a></span><span class="op">(</span>species<span class="op">=</span><span class="fu"><a href="https://rdrr.io/r/base/factor.html" class="external-link">factor</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/rep.html" class="external-link">rep</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"Bluefin Tuna"</span><span class="op">)</span>,<span class="fl">30</span><span class="op">)</span><span class="op">)</span>,</span></span>
<span class="r-in"><span>                  tl<span class="op">=</span><span class="fu"><a href="https://rdrr.io/r/base/Round.html" class="external-link">round</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/stats/Normal.html" class="external-link">rnorm</a></span><span class="op">(</span><span class="fl">30</span>,<span class="fl">1900</span>,<span class="fl">300</span><span class="op">)</span>,<span class="fl">0</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">dbt</span><span class="op">$</span><span class="va">wt</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/Round.html" class="external-link">round</a></span><span class="op">(</span><span class="fl">4.5e-05</span><span class="op">*</span><span class="va">dbt</span><span class="op">$</span><span class="va">tl</span><span class="op">^</span><span class="fl">2.8</span><span class="op">+</span><span class="fu"><a href="https://rdrr.io/r/stats/Normal.html" class="external-link">rnorm</a></span><span class="op">(</span><span class="fl">30</span>,<span class="fl">0</span>,<span class="fl">6000</span><span class="op">)</span>,<span class="fl">1</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">dbg</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a></span><span class="op">(</span>species<span class="op">=</span><span class="fu"><a href="https://rdrr.io/r/base/factor.html" class="external-link">factor</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/rep.html" class="external-link">rep</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"Bluegill"</span><span class="op">)</span>,<span class="fl">30</span><span class="op">)</span><span class="op">)</span>,</span></span>
<span class="r-in"><span>                  tl<span class="op">=</span><span class="fu"><a href="https://rdrr.io/r/base/Round.html" class="external-link">round</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/stats/Normal.html" class="external-link">rnorm</a></span><span class="op">(</span><span class="fl">30</span>,<span class="fl">130</span>,<span class="fl">50</span><span class="op">)</span>,<span class="fl">0</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">dbg</span><span class="op">$</span><span class="va">wt</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/Round.html" class="external-link">round</a></span><span class="op">(</span><span class="fl">4.23e-06</span><span class="op">*</span><span class="va">dbg</span><span class="op">$</span><span class="va">tl</span><span class="op">^</span><span class="fl">3.316</span><span class="op">+</span><span class="fu"><a href="https://rdrr.io/r/stats/Normal.html" class="external-link">rnorm</a></span><span class="op">(</span><span class="fl">30</span>,<span class="fl">0</span>,<span class="fl">10</span><span class="op">)</span>,<span class="fl">1</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">dlb</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a></span><span class="op">(</span>species<span class="op">=</span><span class="fu"><a href="https://rdrr.io/r/base/factor.html" class="external-link">factor</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/rep.html" class="external-link">rep</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"Largemouth Bass"</span><span class="op">)</span>,<span class="fl">30</span><span class="op">)</span><span class="op">)</span>,</span></span>
<span class="r-in"><span>                  tl<span class="op">=</span><span class="fu"><a href="https://rdrr.io/r/base/Round.html" class="external-link">round</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/stats/Normal.html" class="external-link">rnorm</a></span><span class="op">(</span><span class="fl">30</span>,<span class="fl">350</span>,<span class="fl">60</span><span class="op">)</span>,<span class="fl">0</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">dlb</span><span class="op">$</span><span class="va">wt</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/Round.html" class="external-link">round</a></span><span class="op">(</span><span class="fl">2.96e-06</span><span class="op">*</span><span class="va">dlb</span><span class="op">$</span><span class="va">tl</span><span class="op">^</span><span class="fl">3.273</span><span class="op">+</span><span class="fu"><a href="https://rdrr.io/r/stats/Normal.html" class="external-link">rnorm</a></span><span class="op">(</span><span class="fl">30</span>,<span class="fl">0</span>,<span class="fl">60</span><span class="op">)</span>,<span class="fl">1</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">df</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/cbind.html" class="external-link">rbind</a></span><span class="op">(</span><span class="va">dbt</span>,<span class="va">dbg</span>,<span class="va">dlb</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="fu"><a href="https://rdrr.io/r/utils/str.html" class="external-link">str</a></span><span class="op">(</span><span class="va">df</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 'data.frame':	90 obs. of  3 variables:</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  $ species: Factor w/ 3 levels "Bluefin Tuna",..: 1 1 1 1 1 1 1 1 1 1 ...</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  $ tl     : num  1371 1558 2031 2226 2124 ...</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  $ wt     : num  19231 38147 90530 104718 88761 ...</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="va">df</span><span class="op">$</span><span class="va">Wr1</span> <span class="op">&lt;-</span> <span class="fu">wrAdd</span><span class="op">(</span><span class="va">wt</span><span class="op">~</span><span class="va">tl</span><span class="op">+</span><span class="va">species</span>,data<span class="op">=</span><span class="va">df</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="co">## same but with non-formula interface</span></span></span>
<span class="r-in"><span><span class="va">df</span><span class="op">$</span><span class="va">Wr2</span> <span class="op">&lt;-</span> <span class="fu">wrAdd</span><span class="op">(</span><span class="va">df</span><span class="op">$</span><span class="va">wt</span>,<span class="va">df</span><span class="op">$</span><span class="va">tl</span>,<span class="va">df</span><span class="op">$</span><span class="va">species</span><span class="op">)</span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co">## Same as above but using dplyr</span></span></span>
<span class="r-in"><span><span class="kw">if</span> <span class="op">(</span><span class="kw"><a href="https://rdrr.io/r/base/library.html" class="external-link">require</a></span><span class="op">(</span><span class="va"><a href="https://dplyr.tidyverse.org" class="external-link">dplyr</a></span><span class="op">)</span><span class="op">)</span> <span class="op">{</span></span></span>
<span class="r-in"><span>  <span class="va">df</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://dplyr.tidyverse.org/reference/mutate.html" class="external-link">mutate</a></span><span class="op">(</span><span class="va">df</span>,Wr3a<span class="op">=</span><span class="fu">wrAdd</span><span class="op">(</span><span class="va">wt</span>,<span class="va">tl</span>,<span class="va">species</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="op">}</span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="va">df</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>            species   tl       wt       Wr1       Wr2      Wr3a</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 1     Bluefin Tuna 1371  19231.0        NA        NA        NA</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 2     Bluefin Tuna 1558  38146.9        NA        NA        NA</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 3     Bluefin Tuna 2031  90530.4        NA        NA        NA</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 4     Bluefin Tuna 2226 104718.3        NA        NA        NA</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 5     Bluefin Tuna 2124  88760.7        NA        NA        NA</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 6     Bluefin Tuna 1685  62842.5        NA        NA        NA</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 7     Bluefin Tuna 1951  79294.6        NA        NA        NA</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 8     Bluefin Tuna 2136  88992.9        NA        NA        NA</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 9     Bluefin Tuna 1638  50819.4        NA        NA        NA</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 10    Bluefin Tuna 2060  84458.4        NA        NA        NA</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 11    Bluefin Tuna 1857  64052.5        NA        NA        NA</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 12    Bluefin Tuna 2382 125738.2        NA        NA        NA</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 13    Bluefin Tuna 2021  85658.6        NA        NA        NA</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 14    Bluefin Tuna 1862  58800.5        NA        NA        NA</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 15    Bluefin Tuna 1814  60758.3        NA        NA        NA</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 16    Bluefin Tuna 1953  78388.3        NA        NA        NA</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 17    Bluefin Tuna 2079  79556.7        NA        NA        NA</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 18    Bluefin Tuna 1840  66489.0        NA        NA        NA</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 19    Bluefin Tuna 2049  92100.8        NA        NA        NA</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 20    Bluefin Tuna 2545 142705.1        NA        NA        NA</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 21    Bluefin Tuna 2037 100179.1        NA        NA        NA</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 22    Bluefin Tuna 1310  16968.9        NA        NA        NA</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 23    Bluefin Tuna 2028  79251.3        NA        NA        NA</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 24    Bluefin Tuna 1767  49999.8        NA        NA        NA</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 25    Bluefin Tuna 1970  76008.7        NA        NA        NA</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 26    Bluefin Tuna 1866  61425.8        NA        NA        NA</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 27    Bluefin Tuna 1777  56046.1        NA        NA        NA</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 28    Bluefin Tuna 1682  55881.3        NA        NA        NA</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 29    Bluefin Tuna 2295 112096.0        NA        NA        NA</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 30    Bluefin Tuna 1889  59611.6        NA        NA        NA</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 31        Bluegill  158     75.3  91.21118  91.21118  91.21118</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 32        Bluegill  157     80.3  99.33729  99.33729  99.33729</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 33        Bluegill  126     26.0  66.70289  66.70289  66.70289</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 34        Bluegill  203    196.2 103.52426 103.52426 103.52426</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 35        Bluegill  136     59.9 119.29213 119.29213 119.29213</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 36        Bluegill  192    159.4 101.17226 101.17226 101.17226</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 37        Bluegill  132     54.9 120.71165 120.71165 120.71165</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 38        Bluegill  121     30.7  90.07870  90.07870  90.07870</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 39        Bluegill  136     42.4  84.44051  84.44051  84.44051</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 40        Bluegill   52     -5.8        NA        NA        NA</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 41        Bluegill  111     17.5  68.35134  68.35134  68.35134</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 42        Bluegill  226    267.8  98.98901  98.98901  98.98901</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 43        Bluegill  217    238.2 100.74912 100.74912 100.74912</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 44        Bluegill  163     86.9  94.93048  94.93048  94.93048</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 45        Bluegill  119     18.3  56.74628  56.74628  56.74628</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 46        Bluegill   79     17.9        NA        NA        NA</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 47        Bluegill   78      3.5        NA        NA        NA</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 48        Bluegill  172    113.9 104.11454 104.11454 104.11454</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 49        Bluegill  106     28.0 127.42181 127.42181 127.42181</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 50        Bluegill  122     36.7 104.78446 104.78446 104.78446</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 51        Bluegill   95     14.1  92.27576  92.27576  92.27576</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 52        Bluegill   47     -3.3        NA        NA        NA</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 53        Bluegill  155     72.8  93.97048  93.97048  93.97048</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 54        Bluegill  167    101.5 102.31474 102.31474 102.31474</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 55        Bluegill  146     65.1 102.46768 102.46768 102.46768</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 56        Bluegill  125     54.5 143.56312 143.56312 143.56312</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 57        Bluegill   66     -7.1        NA        NA        NA</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 58        Bluegill  160     92.1 107.00345 107.00345 107.00345</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 59        Bluegill   85      1.7  16.08777  16.08777  16.08777</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 60        Bluegill   72     19.0        NA        NA        NA</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 61 Largemouth Bass  351    537.7  84.67395  84.67395  84.67395</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 62 Largemouth Bass  297    480.0 130.58984 130.58984 130.58984</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 63 Largemouth Bass  358    598.2  88.30540  88.30540  88.30540</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 64 Largemouth Bass  451   1435.8  99.53461  99.53461  99.53461</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 65 Largemouth Bass  375    676.8  85.83334  85.83334  85.83334</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 66 Largemouth Bass  429   1230.9 100.50555 100.50555 100.50555</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 67 Largemouth Bass  393    904.5  98.39245  98.39245  98.39245</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 68 Largemouth Bass  168    104.3 183.16691 183.16691 183.16691</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 69 Largemouth Bass  358    567.9  83.83256  83.83256  83.83256</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 70 Largemouth Bass  396    900.0  95.49622  95.49622  95.49622</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 71 Largemouth Bass  319    481.4 103.65713 103.65713 103.65713</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 72 Largemouth Bass  325    476.1  96.45038  96.45038  96.45038</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 73 Largemouth Bass  305    386.9  96.49068  96.49068  96.49068</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 74 Largemouth Bass  343    505.1  85.77480  85.77480  85.77480</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 75 Largemouth Bass  359    720.1 105.33403 105.33403 105.33403</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 76 Largemouth Bass  295    349.4  97.18415  97.18415  97.18415</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 77 Largemouth Bass  355    561.3  85.17216  85.17216  85.17216</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 78 Largemouth Bass  336    630.0 114.45429 114.45429 114.45429</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 79 Largemouth Bass  502   2053.0 100.22722 100.22722 100.22722</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 80 Largemouth Bass  328    553.9 108.88706 108.88706 108.88706</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 81 Largemouth Bass  387    899.9 102.94761 102.94761 102.94761</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 82 Largemouth Bass  324    510.4 104.44721 104.44721 104.44721</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 83 Largemouth Bass  387    875.1 100.11051 100.11051 100.11051</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 84 Largemouth Bass  274    243.7  86.31732  86.31732  86.31732</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 85 Largemouth Bass  437   1347.0 103.53134 103.53134 103.53134</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 86 Largemouth Bass  313    412.5  94.51644  94.51644  94.51644</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 87 Largemouth Bass  260    182.4  76.70383  76.70383  76.70383</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 88 Largemouth Bass  441   1288.2  96.10274  96.10274  96.10274</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 89 Largemouth Bass  266    265.7 103.69408 103.69408 103.69408</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 90 Largemouth Bass  371    612.6  80.46670  80.46670  80.46670</span>
<span class="r-in"><span> </span></span>
<span class="r-in"><span><span class="co">## Example with only one species in the data.frame</span></span></span>
<span class="r-in"><span><span class="va">bg</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/droplevels.html" class="external-link">droplevels</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/subset.html" class="external-link">subset</a></span><span class="op">(</span><span class="va">df</span>,<span class="va">species</span><span class="op">==</span><span class="st">"Bluegill"</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="va">bg</span><span class="op">$</span><span class="va">Wr4</span> <span class="op">&lt;-</span> <span class="fu">wrAdd</span><span class="op">(</span><span class="va">wt</span><span class="op">~</span><span class="va">tl</span><span class="op">+</span><span class="va">species</span>,data<span class="op">=</span><span class="va">bg</span><span class="op">)</span></span></span>
<span class="r-in"><span></span></span>
</code></pre></div>
    </div>
  </main><aside class="col-md-3"><nav id="toc"><h2>On this page</h2>
    </nav></aside></div>


    <footer><div class="pkgdown-footer-left">
  <p></p><p>Developed by <a href="http://derekogle.com" class="external-link">Derek H. Ogle</a>, Jason C. Doll, A. Powell Wheeler, Alexis Dinno.</p>
</div>

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

    </footer></div>

  

  

  </body></html>

