<!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="Creates a vector of lengths for the individuals not measured based on the lengths measured in a subsample of individuals."><title>Expands a length frequency based on a subsample. — expandLenFreq • 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="Expands a length frequency based on a subsample. — expandLenFreq"><meta property="og:description" content="Creates a vector of lengths for the individuals not measured based on the lengths measured in a subsample of individuals."><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>Expands a length frequency based on a subsample.</h1>
      <small class="dont-index">Source: <a href="https://github.com/fishR-Core-Team/FSA/blob/HEAD/R/expandLenFreq.R" class="external-link"><code>R/expandLenFreq.R</code></a></small>
      <div class="d-none name"><code>expandLenFreq.Rd</code></div>
    </div>

    <div class="ref-description section level2">
    <p>Creates a vector of lengths for the individuals not measured based on the lengths measured in a subsample of individuals.</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">expandLenFreq</span><span class="op">(</span></span>
<span>  <span class="va">x</span>,</span>
<span>  <span class="va">w</span>,</span>
<span>  <span class="va">additional</span>,</span>
<span>  startcat <span class="op">=</span> <span class="cn">NULL</span>,</span>
<span>  total <span class="op">=</span> <span class="va">additional</span> <span class="op">+</span> <span class="fu"><a href="https://rdrr.io/r/base/length.html" class="external-link">length</a></span><span class="op">(</span><span class="va">x</span><span class="op">)</span>,</span>
<span>  decimals <span class="op">=</span> <span class="va">decs</span><span class="op">$</span><span class="va">wdec</span>,</span>
<span>  show.summary <span class="op">=</span> <span class="cn">TRUE</span>,</span>
<span>  <span class="va">...</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>x</dt>
<dd><p>A numeric vector of length measurements.</p></dd>


<dt>w</dt>
<dd><p>A number that indicates the width of length classes to create.</p></dd>


<dt>additional</dt>
<dd><p>The number of individuals that were not measured in the sample (for which measurements should be determined).</p></dd>


<dt>startcat</dt>
<dd><p>A number that indicates the beginning of the first length-class.</p></dd>


<dt>total</dt>
<dd><p>The total number of individuals in the sample (including those that were measured in the subsample).</p></dd>


<dt>decimals</dt>
<dd><p>A number that indicates the number of decimals used in the output vector of estimated lengths.</p></dd>


<dt>show.summary</dt>
<dd><p>A logical that indicates whether a summary of the process should be shown at the end.</p></dd>


<dt>...</dt>
<dd><p>Optional arguments to be passed to <code><a href="lencat.html">lencat</a></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 vector that consists of measurements for the non-measured individuals in the entire sample.</p>
    </div>
    <div class="section level2">
    <h2 id="details">Details<a class="anchor" aria-label="anchor" href="#details"></a></h2>
    <p>Creates a vector of lengths for the individuals not measured based on the lengths measured in a subsample of individuals. Length categories are created first that begin with the value in <code>startcat</code> (or the minimum observed value by default) and continue by values of <code>w</code> until a category value greater than the largest observed length in <code>x</code>. Categories of different widths are not allowed.</p>
<p>The resulting “expanded” lengths are created by allocating individuals to each length class based on the proportion of measured individuals in the subsample in that length class. Individuals within a length class are then assigned a specific length within that length class based on a uniform distribution. Because the expanded number of individuals in a length class is rounded down based on the measured number per length class, not all individuals will initially be assigned a length value. The remaining individuals are assigned to a length class randomly according to weights based on the proportion of individuals in the measured length classes. Finally, these individuals are randomly assigned a specific length within the respective length class from a uniform distribution, same as above.</p>
<p>The resulting length assignments are rounded to the number of decimals shown in <code>decimal</code>. If <code>decimals</code> is not set by the user then it will default to the same number of decimals shown in the <code>w</code> value. Care is taken to make sure that the rounded result will not pass out of the given length category (i.e., will not be allowed to round up to the next length category). Generally speaking, one will want to use more decimals then is shown in <code>w</code>. For example, one may want to create length categories with a width of 1 inch (i.e., <code>w=1</code>) but have the results recorded as if measured to within 0.1 inch (i.e., <code>decimals=1</code>).</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="expandCounts.html">expandCounts</a></code> for expanding more than just lengths or expanding lengths when there is a known number in each length bin. See <code><a href="lencat.html">lencat</a></code> for creating length bins.</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">## Set the random seed for reproducibility</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">15343437</span><span class="op">)</span></span></span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co">## First example</span></span></span>
<span class="r-in"><span><span class="co"># random lengths measured to nearest 0.1 unit -- values in a vector</span></span></span>
<span class="r-in"><span><span class="va">len1</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="fu"><a href="https://rdrr.io/r/stats/Uniform.html" class="external-link">runif</a></span><span class="op">(</span><span class="fl">50</span>,<span class="fl">0.1</span>,<span class="fl">9.9</span><span class="op">)</span>,<span class="fl">1</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="co"># assignment of integer lengths to 110 non-measured individuals</span></span></span>
<span class="r-in"><span><span class="va">new.len1a</span> <span class="op">&lt;-</span> <span class="fu">expandLenFreq</span><span class="op">(</span><span class="va">len1</span>,w<span class="op">=</span><span class="fl">1</span>,total<span class="op">=</span><span class="fl">160</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Length Frequency Expansion using:</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  Measured length frequency of 50 individuals:</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>    0    1    2    3    4    5    6    7    8    9 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 0.08 0.06 0.04 0.08 0.14 0.10 0.14 0.04 0.16 0.16 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Non-random allocations of 105 individuals by length category.</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  [1]  8  6  4  8 15 11 15  4 17 17</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Random allocations of 5 individuals</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  With final length frequency table of:</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  0  1  2  3  4  5  6  7  8  9 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  8  6  4  8 17 11 15  4 20 17 </span>
<span class="r-in"><span><span class="va">new.len1a</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>   [1] 0 0 0 0 0 0 0 0 1 1 1 1 1 1 2 2 2 2 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  [38] 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 8</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  [75] 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9</span>
<span class="r-in"><span><span class="co"># assignment of lengths to 0.1 to 110 non-measured individuals</span></span></span>
<span class="r-in"><span><span class="va">new.len1b</span> <span class="op">&lt;-</span> <span class="fu">expandLenFreq</span><span class="op">(</span><span class="va">len1</span>,w<span class="op">=</span><span class="fl">1</span>,total<span class="op">=</span><span class="fl">160</span>,decimals<span class="op">=</span><span class="fl">1</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Length Frequency Expansion using:</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  Measured length frequency of 50 individuals:</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>    0    1    2    3    4    5    6    7    8    9 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 0.08 0.06 0.04 0.08 0.14 0.10 0.14 0.04 0.16 0.16 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Non-random allocations of 105 individuals by length category.</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  [1]  8  6  4  8 15 11 15  4 17 17</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Random allocations of 5 individuals</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  With final length frequency table of:</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  0  1  2  3  4  5  6  7  8  9 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  8  6  5  8 16 11 16  4 19 17 </span>
<span class="r-in"><span><span class="va">new.len1b</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>   [1] 0.1 0.1 0.2 0.3 0.3 0.3 0.5 0.9 1.3 1.4 1.5 1.5 1.6 1.6 2.1 2.1 2.3 2.6</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  [19] 2.8 3.0 3.1 3.3 3.5 3.5 3.7 3.8 3.9 4.0 4.1 4.2 4.3 4.3 4.4 4.4 4.5 4.6</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  [37] 4.7 4.8 4.8 4.8 4.8 4.8 4.9 5.0 5.1 5.3 5.4 5.6 5.6 5.8 5.8 5.8 5.8 5.9</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  [55] 6.0 6.1 6.2 6.4 6.5 6.6 6.6 6.6 6.6 6.6 6.7 6.8 6.8 6.8 6.9 6.9 7.4 7.5</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  [73] 7.6 7.6 8.0 8.0 8.0 8.0 8.1 8.2 8.3 8.3 8.3 8.3 8.3 8.4 8.4 8.6 8.7 8.7</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  [91] 8.8 8.8 8.8 9.0 9.2 9.2 9.2 9.2 9.2 9.3 9.3 9.4 9.5 9.6 9.6 9.6 9.8 9.8</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [109] 9.8 9.8</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co">## Second example -- if values are in a data.frame</span></span></span>
<span class="r-in"><span><span class="co"># random lengths measured to nearest 0.1 unit</span></span></span>
<span class="r-in"><span><span class="va">len2</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>len<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/Uniform.html" class="external-link">runif</a></span><span class="op">(</span><span class="fl">50</span>,<span class="fl">10</span>,<span class="fl">117</span><span class="op">)</span>,<span class="fl">1</span><span class="op">)</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="co"># assignment of lengths to 0.1 for 140 non-measured indivs</span></span></span>
<span class="r-in"><span><span class="va">new.len2a</span> <span class="op">&lt;-</span> <span class="fu">expandLenFreq</span><span class="op">(</span><span class="va">len2</span><span class="op">$</span><span class="va">len</span>,w<span class="op">=</span><span class="fl">10</span>,total<span class="op">=</span><span class="fl">190</span>,decimals<span class="op">=</span><span class="fl">1</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Length Frequency Expansion using:</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  Measured length frequency of 50 individuals:</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>   10   20   30   40   50   60   70   80   90  100  110 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 0.06 0.06 0.06 0.14 0.04 0.10 0.12 0.14 0.12 0.04 0.12 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Non-random allocations of 134 individuals by length category.</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  [1]  8  8  8 19  5 14 16 19 16  5 16</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Random allocations of 6 individuals</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  With final length frequency table of:</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  10  20  30  40  50  60  70  80  90 100 110 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span>   8   8   8  20   6  15  18  20  16   5  16 </span>
<span class="r-in"><span><span class="va">new.len2a</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>   [1]  10.1  10.7  12.2  15.9  16.2  16.3  17.8  18.2  24.2  25.0  25.4  25.6</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  [13]  27.0  27.5  29.1  29.9  31.2  31.9  31.9  32.9  33.5  36.0  38.0  38.6</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  [25]  41.0  41.8  42.5  42.7  42.7  42.8  43.1  43.3  43.4  44.0  44.2  44.2</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  [37]  44.9  45.1  47.3  47.5  49.1  49.1  49.6  49.6  51.9  52.1  55.4  56.6</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  [49]  58.1  58.7  60.1  61.3  61.6  62.1  64.5  64.6  66.3  66.8  67.7  67.8</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  [61]  68.0  68.3  68.5  68.5  69.3  70.8  71.2  71.5  72.4  72.5  72.5  72.8</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  [73]  73.0  74.0  75.8  76.7  76.8  77.3  77.5  78.2  78.7  79.9  79.9  80.4</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  [85]  80.6  80.7  81.7  82.8  85.1  85.5  85.7  86.4  86.6  87.0  87.1  87.2</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  [97]  87.7  88.8  88.8  89.0  89.1  89.5  89.5  90.0  90.6  91.8  92.4  92.5</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [109]  92.5  93.7  93.8  94.6  94.7  95.2  95.3  95.9  96.2  98.6  99.5 103.6</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [121] 104.6 104.9 106.0 109.5 110.4 111.1 111.4 111.7 112.5 112.6 113.9 114.1</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [133] 114.1 114.5 115.2 116.8 117.1 118.6 119.3 119.7</span>
<span class="r-in"><span></span></span>
<span class="r-in"><span><span class="co">## Third example</span></span></span>
<span class="r-in"><span><span class="co"># hypothetically measured lengths</span></span></span>
<span class="r-in"><span><span class="va">len</span> <span class="op">&lt;-</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="fl">6.7</span>,<span class="fl">6.9</span>,<span class="fl">7.3</span>,<span class="fl">7.4</span>,<span class="fl">7.5</span>,<span class="fl">8.2</span>,<span class="fl">8.7</span>,<span class="fl">8.9</span><span class="op">)</span></span></span>
<span class="r-in"><span><span class="co"># find lengths for unmeasured fish assuming a total of 30</span></span></span>
<span class="r-in"><span><span class="va">newlen1</span> <span class="op">&lt;-</span> <span class="fu">expandLenFreq</span><span class="op">(</span><span class="va">len</span>,w<span class="op">=</span><span class="fl">0.5</span>,total<span class="op">=</span><span class="fl">30</span>,decimals<span class="op">=</span><span class="fl">1</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Length Frequency Expansion using:</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  Measured length frequency of 8 individuals:</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>   6.5     7   7.5     8   8.5 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 0.250 0.250 0.125 0.125 0.250 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Non-random allocations of 19 individuals by length category.</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 5 5 2 2 5</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Random allocations of 3 individuals</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  With final length frequency table of:</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 6.5   7 7.5   8 8.5 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span>   6   5   2   4   5 </span>
<span class="r-in"><span><span class="va">newlen1</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  [1] 6.6 6.7 6.7 6.7 6.8 6.9 7.1 7.1 7.2 7.3 7.3 7.5 7.7 8.0 8.2 8.3 8.3 8.5 8.6</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [20] 8.7 8.8 8.8</span>
<span class="r-in"><span><span class="co"># set a starting length category</span></span></span>
<span class="r-in"><span><span class="va">newlen2</span> <span class="op">&lt;-</span> <span class="fu">expandLenFreq</span><span class="op">(</span><span class="va">len</span>,w<span class="op">=</span><span class="fl">0.5</span>,startcat<span class="op">=</span><span class="fl">6.2</span>,total<span class="op">=</span><span class="fl">30</span>,decimals<span class="op">=</span><span class="fl">1</span><span class="op">)</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Length Frequency Expansion using:</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  Measured length frequency of 8 individuals:</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>   6.7   7.2   8.2   8.7 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 0.250 0.375 0.125 0.250 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Non-random allocations of 20 individuals by length category.</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [1] 5 8 2 5</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> </span>
<span class="r-out co"><span class="r-pr">#&gt;</span> Random allocations of 2 individuals</span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  With final length frequency table of:</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> 6.7 7.2 8.2 8.7 </span>
<span class="r-out co"><span class="r-pr">#&gt;</span>   6   9   2   5 </span>
<span class="r-in"><span><span class="va">newlen2</span></span></span>
<span class="r-out co"><span class="r-pr">#&gt;</span>  [1] 6.7 6.7 6.9 6.9 6.9 6.9 7.2 7.3 7.3 7.3 7.4 7.4 7.4 7.6 7.6 8.4 8.5 8.7 8.8</span>
<span class="r-out co"><span class="r-pr">#&gt;</span> [20] 9.0 9.0 9.1</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>

