Error(s) in re-building vignettes:
--- re-building 'Air_Stripper.Rmd' using rmarkdown
Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-2'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-3'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

trying URL 'https://i.creativecommons.org/l/by-sa/4.0/88x31.png'
Content type 'image/png' length 1515 bytes
==================================================
downloaded 1515 bytes

! libpng error: PNG file corrupted by ASCII conversion

! xdvipdfmx:fatal: File ended prematurely

! Output file removed.

Error: processing vignette 'Air_Stripper.Rmd' failed with diagnostics:
LaTeX failed to compile d:/RCompile/CRANpkg/local/4.1/iemisc.Rcheck/vign_test/iemisc/vignettes/Air_Stripper.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Air_Stripper.log for more info.
--- failed re-building 'Air_Stripper.Rmd'

--- re-building 'Comparing_Manningtrap.Rmd' using rmarkdown
Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-1'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-2'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-5'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-8'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

trying URL 'https://i.creativecommons.org/l/by-sa/4.0/88x31.png'
Content type 'image/png' length 1515 bytes
==================================================
downloaded 1515 bytes

! libpng error: PNG file corrupted by ASCII conversion

! xdvipdfmx:fatal: File ended prematurely

! Output file removed.

Error: processing vignette 'Comparing_Manningtrap.Rmd' failed with diagnostics:
LaTeX failed to compile d:/RCompile/CRANpkg/local/4.1/iemisc.Rcheck/vign_test/iemisc/vignettes/Comparing_Manningtrap.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Comparing_Manningtrap.log for more info.
--- failed re-building 'Comparing_Manningtrap.Rmd'

--- re-building 'Comparing_Saturated_Vapor_Pressures.Rmd' using rmarkdown
Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-1'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-2'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-3'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

trying URL 'https://i.creativecommons.org/l/by-sa/4.0/88x31.png'
Content type 'image/png' length 1515 bytes
==================================================
downloaded 1515 bytes

! libpng error: PNG file corrupted by ASCII conversion

! xdvipdfmx:fatal: File ended prematurely

! Output file removed.

Error: processing vignette 'Comparing_Saturated_Vapor_Pressures.Rmd' failed with diagnostics:
LaTeX failed to compile d:/RCompile/CRANpkg/local/4.1/iemisc.Rcheck/vign_test/iemisc/vignettes/Comparing_Saturated_Vapor_Pressures.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Comparing_Saturated_Vapor_Pressures.log for more info.
--- failed re-building 'Comparing_Saturated_Vapor_Pressures.Rmd'

--- re-building 'Construction_Measurement_Examples.Rmd' using rmarkdown
Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-1'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-2'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-3'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-4'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-5'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-6'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-7'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-8'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-9'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-10'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-11'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-12'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

trying URL 'https://i.creativecommons.org/l/by-sa/4.0/88x31.png'
Content type 'image/png' length 1515 bytes
==================================================
downloaded 1515 bytes

! libpng error: PNG file corrupted by ASCII conversion

! xdvipdfmx:fatal: File ended prematurely

! Output file removed.

Error: processing vignette 'Construction_Measurement_Examples.Rmd' failed with diagnostics:
LaTeX failed to compile d:/RCompile/CRANpkg/local/4.1/iemisc.Rcheck/vign_test/iemisc/vignettes/Construction_Measurement_Examples.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Construction_Measurement_Examples.log for more info.
--- failed re-building 'Construction_Measurement_Examples.Rmd'

--- re-building 'Engineering_Survey_Examples.Rmd' using rmarkdown
Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-1'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-2'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-3'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-4'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-5'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-6'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-7'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-8'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-9'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-10'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

trying URL 'https://i.creativecommons.org/l/by-sa/4.0/88x31.png'
Content type 'image/png' length 1515 bytes
==================================================
downloaded 1515 bytes

! libpng error: PNG file corrupted by ASCII conversion

! xdvipdfmx:fatal: File ended prematurely

! Output file removed.

Error: processing vignette 'Engineering_Survey_Examples.Rmd' failed with diagnostics:
LaTeX failed to compile d:/RCompile/CRANpkg/local/4.1/iemisc.Rcheck/vign_test/iemisc/vignettes/Engineering_Survey_Examples.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Engineering_Survey_Examples.log for more info.
--- failed re-building 'Engineering_Survey_Examples.Rmd'

--- re-building 'Friction_Loss_Calculation_Examples.Rmd' using rmarkdown
Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-1'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-2'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-4'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-5'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-6'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-7'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

trying URL 'https://i.creativecommons.org/l/by-sa/4.0/88x31.png'
Content type 'image/png' length 1515 bytes
==================================================
downloaded 1515 bytes

! libpng error: PNG file corrupted by ASCII conversion

! xdvipdfmx:fatal: File ended prematurely

! Output file removed.

Error: processing vignette 'Friction_Loss_Calculation_Examples.Rmd' failed with diagnostics:
LaTeX failed to compile d:/RCompile/CRANpkg/local/4.1/iemisc.Rcheck/vign_test/iemisc/vignettes/Friction_Loss_Calculation_Examples.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Friction_Loss_Calculation_Examples.log for more info.
--- failed re-building 'Friction_Loss_Calculation_Examples.Rmd'

--- re-building 'GNU-Octave_Rem_Mod_fractdiff_Examples.Rmd' using rmarkdown
Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-1'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

running: octave  --eval "
% check against GNU Octave

% Examples from GNU Octave

x = 23.4

y = 20

z = 0

rem(x, y)

rem(y, x)

rem(x, z)

rem(y, z)

rem(z, x)

rem(z, y)

rem(-1, 3)


% Examples from FreeMat

rem(18, 12)

rem(6, 5)

rem(2 * pi, pi)

rem([1, 3, 5, 2], 2)

rem([9 3 2 0], [1 0 2 2])"
Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-3'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

running: octave  --eval "
% check against GNU Octave

% Examples from FreeMat

mod(18, 12)

mod(6, 5)

mod(2*pi, pi)

mod([1, 3, 5, 2], 2)

mod([9 3 2 0], [1 0 2 2])

mod(-1, 3)"
Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-5'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

running: octave  --eval "
% check against GNU Octave

a = [1, 2, 4, 7, 0]

fractdiff(a, d = 0.5)"
trying URL 'https://i.creativecommons.org/l/by-sa/4.0/88x31.png'
Content type 'image/png' length 1515 bytes
==================================================
downloaded 1515 bytes

! libpng error: PNG file corrupted by ASCII conversion

! xdvipdfmx:fatal: File ended prematurely

! Output file removed.

Error: processing vignette 'GNU-Octave_Rem_Mod_fractdiff_Examples.Rmd' failed with diagnostics:
LaTeX failed to compile d:/RCompile/CRANpkg/local/4.1/iemisc.Rcheck/vign_test/iemisc/vignettes/GNU-Octave_Rem_Mod_fractdiff_Examples.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See GNU-Octave_Rem_Mod_fractdiff_Examples.log for more info.
--- failed re-building 'GNU-Octave_Rem_Mod_fractdiff_Examples.Rmd'

--- re-building 'GNU-Octave_cosd_Function_Examples.Rmd' using rmarkdown
Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-1'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

running: octave  --eval "
cosd(90)

cos(pi/2)"
trying URL 'https://i.creativecommons.org/l/by-sa/4.0/88x31.png'
Content type 'image/png' length 1515 bytes
==================================================
downloaded 1515 bytes

! libpng error: PNG file corrupted by ASCII conversion

! xdvipdfmx:fatal: File ended prematurely

! Output file removed.

Error: processing vignette 'GNU-Octave_cosd_Function_Examples.Rmd' failed with diagnostics:
LaTeX failed to compile d:/RCompile/CRANpkg/local/4.1/iemisc.Rcheck/vign_test/iemisc/vignettes/GNU-Octave_cosd_Function_Examples.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See GNU-Octave_cosd_Function_Examples.log for more info.
--- failed re-building 'GNU-Octave_cosd_Function_Examples.Rmd'

--- re-building 'GNU-Octave_size_Function_Examples.Rmd' using rmarkdown
Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-1'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

running: octave  --eval "
% check against GNU Octave

% Example from GNU Octave ndims function reference

size(ones(4, 1, 2, 1))


% Examples from GNU Octave size function reference

object1 = [1, 2; 3, 4; 5, 6]

size(object1)


[nr, nc] = size([1, 2; 3, 4; 5, 6])

size([1, 2; 3, 4; 5, 6], 2)

size([1 2; 3 4; 5 6])

size([1 2; 3 4; 5 6], 2)

[nr, nc] = size([1, 2; 3, 4; 5, 6])
nr
nc

size(ones(2, 3, 4, 5))

[nr, remainder] = size(ones(2, 3, 4, 5))
nr
remainder

size(ones(4, 3, 4, 8), 4)

size(ones(4, 3, 4, 5), 3)




% Examples from pracma size

size(1:8)

object2 = [1 3 5 7; 2 4 6 8]

size(object2)

size(object2, 2)

size(object2, 3)

ss = 'object'

size(ss)"
Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-3'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

running: octave  --eval "
% check against GNU Octave

object1 = [];

length(object1)


object2 = 2;

length(object2)


object3 = 1:10;

length(object3)


object4 = ones(3, 4);

length(object4)


object5 = 'ss';

length(object5)"
Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-5'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

running: octave  --eval "
% check against GNU Octave

xx = {1:26, 1:10}


\% Examples from GNU Octave numel
a = 1;

b = ones(2, 3);

numel(a, b)


a = 2;

b = ones(2, 3);

c = ones(3, 4);

numel(a, b)

numel(a, b, c)


f = [10 12 23; 21 62 93];

g = [2 4];

numel(f, g)
"
Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-7'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

running: octave  --eval "
% check against GNU Octave

% Example from GNU Octave ndims

ndims(ones(4, 1, 2, 1))
"
Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-9'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

running: octave  --eval "
% check against GNU Octave

isrow([1 2])

isrow([1 2; 3 4])
"
Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-11'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

running: octave  --eval "
% check against GNU Octave

iscolumn([1 2])

iscolumn([1; 2])"
trying URL 'https://i.creativecommons.org/l/by-sa/4.0/88x31.png'
Content type 'image/png' length 1515 bytes
==================================================
downloaded 1515 bytes

! libpng error: PNG file corrupted by ASCII conversion

! xdvipdfmx:fatal: File ended prematurely

! Output file removed.

Error: processing vignette 'GNU-Octave_size_Function_Examples.Rmd' failed with diagnostics:
LaTeX failed to compile d:/RCompile/CRANpkg/local/4.1/iemisc.Rcheck/vign_test/iemisc/vignettes/GNU-Octave_size_Function_Examples.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See GNU-Octave_size_Function_Examples.log for more info.
--- failed re-building 'GNU-Octave_size_Function_Examples.Rmd'

--- re-building 'Open-Channel-Flow_Examples_Geometric_Shapes.Rmd' using rmarkdown
Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-1'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-2'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-3'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

trying URL 'https://i.creativecommons.org/l/by-sa/4.0/88x31.png'
Content type 'image/png' length 1515 bytes
==================================================
downloaded 1515 bytes

! libpng error: PNG file corrupted by ASCII conversion

! xdvipdfmx:fatal: File ended prematurely

! Output file removed.

Error: processing vignette 'Open-Channel-Flow_Examples_Geometric_Shapes.Rmd' failed with diagnostics:
LaTeX failed to compile d:/RCompile/CRANpkg/local/4.1/iemisc.Rcheck/vign_test/iemisc/vignettes/Open-Channel-Flow_Examples_Geometric_Shapes.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Open-Channel-Flow_Examples_Geometric_Shapes.log for more info.
--- failed re-building 'Open-Channel-Flow_Examples_Geometric_Shapes.Rmd'

--- re-building 'Reynolds_number_Calculation_Examples.Rmd' using rmarkdown
Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-1'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-2'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-3'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-4'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

trying URL 'https://i.creativecommons.org/l/by-sa/4.0/88x31.png'
Content type 'image/png' length 1515 bytes
==================================================
downloaded 1515 bytes

! libpng error: PNG file corrupted by ASCII conversion

! xdvipdfmx:fatal: File ended prematurely

! Output file removed.

Error: processing vignette 'Reynolds_number_Calculation_Examples.Rmd' failed with diagnostics:
LaTeX failed to compile d:/RCompile/CRANpkg/local/4.1/iemisc.Rcheck/vign_test/iemisc/vignettes/Reynolds_number_Calculation_Examples.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Reynolds_number_Calculation_Examples.log for more info.
--- failed re-building 'Reynolds_number_Calculation_Examples.Rmd'

--- re-building 'secprop_R_GNU-Octave_Example.Rmd' using rmarkdown
Warning in eng_r(options) :
  Failed to tidy R code in chunk 'unnamed-chunk-1'. Reason:
Error : The formatR package is required by the chunk option tidy = TRUE but not installed; tidy = TRUE will be ignored.

running: octave  --eval "%
%    Copyright (C) 2008  Colin Caprani - www.colincaprani.com
%
%    This program is free software: you can redistribute it and/or modify
%    it under the terms of the GNU General Public License as published by
%    the Free Software Foundation, either version 3 of the License, or
%    (at your option) any later version.
%
%    This program is distributed in the hope that it will be useful,
%    but WITHOUT ANY WARRANTY; without even the implied warranty of
%    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%    GNU General Public License for more details.
%
%    You should have received a copy of the GNU General Public License
%    along with this program.  If not, see <http://www.gnu.org/licenses/>.

function SP = secprop(outer,inner,plotflag)
% Section Properties Calculator
% outer is a matrix of outer coordinates (x,y)
% inner is a matrix of coordinates for a void
% SP is a vector of A,I,yt and yb properties of the section

    [nOC n] = size(outer); [nIC n] = size(inner);
    outer(nOC+1,:) = outer(1,:);
    inner(nIC+1,:) = inner(1,:);
   
    propsOC = zeros(1,3); propsIC = propsOC;
    propsOC = algor(outer);
    if(nIC > 2); propsIC = algor(inner); end;
    A = propsOC(1) - propsIC(1);
    I = propsOC(2) - propsIC(2);
    ybar = propsOC(3) - propsIC(3);
    
    ybar = ybar/A;
    I = I-A*ybar^2;   
    A = 2*A; I = 2*I;
    yt = max(outer(:,2)) - ybar;
    yb = ybar;
    SP = [A,I,yt,yb]; SP = SP';
    
    if plotflag == 1
        outer(nOC+1:2*nOC-1,1) = -outer(nOC:-1:2,1);
        outer(nOC+1:2*nOC-1,2) =  outer(nOC:-1:2,2);
        inner(nIC+1:2*nIC-1,1) = -inner(nIC:-1:2,1);
        inner(nIC+1:2*nIC-1,2) =  inner(nIC:-1:2,2);
        h = fill(outer(:,1),outer(:,2),'r'); hold on;
        fill(inner(:,1),inner(:,2),'w'); axis equal;

        s1 = sprintf('Area = %d mm2 | Height to N-A = %3.1f mm',A,round(ybar*10)/10);
        s2 = sprintf('Second Moment of Area = %d mm4',I);
        s3 = sprintf('Elastic Moduli, t = %d mm3; b = %d mm3',I/yt,I/yb);
        annotation1 = annotation('textbox',[0.15 0.12 0.4 0.14],
        {s1,s2,s3});
% annotation1 line modified by Irucka Embry to avoid the error message associated with
% set: unknown hggroup property FitHeightToText
    end
end

function props = algor(vc)
    A = 0; ybar = 0; I = 0;
    x = vc(:,1); y = vc(:,2);
    n = length(x);
    for i = 1:(n-1)
        A = A + 0.5*(x(i)-x(i+1))*(y(i)+y(i+1));
        ybar = ybar + (1/6)*(x(i)-x(i+1))*(y(i)^2 + y(i)*y(i+1) + y(i+1)^2);
        I = I + (1/12)*(x(i)-x(i+1))*(y(i)^3 + y(i)^2*y(i+1)+y(i)*y(i+1)^2 + y(i+1)^3);
    end
    props = [A,I,ybar];
end


% check against GNU Octave

vo = [0, 0; 600, 0; 630, 580; 1200, 650; 1200, 920; 900, 920; 900, 845; 0, 845];
vi = [0, 300; 300, 300; 300, 695; 0, 695];
SP = secprop(vo, vi, 1)"
Warning in system2(cmd, code, stdout = TRUE, stderr = TRUE, env = options$engine.env) :
  running command '"octave"  --eval "%
%    Copyright (C) 2008  Colin Caprani - www.colincaprani.com
%
%    This program is free software: you can redistribute it and/or modify
%    it under the terms of the GNU General Public License as published by
%    the Free Software Foundation, either version 3 of the License, or
%    (at your option) any later version.
%
%    This program is distributed in the hope that it will be useful,
%    but WITHOUT ANY WARRANTY; without even the implied warranty of
%    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%    GNU General Public License for more details.
%
%    You should have received a copy of the GNU General Public License
%    along with this program.  If not, see <http://www.gnu.org/licenses/>.

function SP = secprop(outer,inner,plotflag)
% Section Properties Calculator
% outer is a matrix of outer coordinates (x,y)
% inner is a matrix of coordinates for a void
% SP is a vector of A,I,yt and yb properties of the section

     [... truncated]
Quitting from lines 48-124 (secprop_R_GNU-Octave_Example.Rmd) 
Error: processing vignette 'secprop_R_GNU-Octave_Example.Rmd' failed with diagnostics:
GNU Octave, version 3.6.4
Copyright (C) 2013 John W. Eaton and others.
This is free software; see the source code for copying conditions.
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  For details, type `warranty'.

Octave was configured for "i686-pc-mingw32".

Additional information about Octave is available at http://www.octave.org.

Please contribute if you find this software useful.
For more information, visit http://www.octave.org/get-involved.html

Read http://www.octave.org/bugs.html to learn how to submit bug reports.

For information about changes from previous versions, type `news'.

OpenBLAS : Your OS does not support AVX instructions. OpenBLAS is using Nehalem kernels as a fallback, which may give poorer performance.
warning: the 'annotation' function is not yet implemented in Octave

Please read `http://www.octave.org/missing.html' to learn how you can
contribute missing functionality.


error: 'annotation' undefined near line 36 column 23
error: called from:
error:   secprop at line 36, column 21
--- failed re-building 'secprop_R_GNU-Octave_Example.Rmd'

SUMMARY: processing the following files failed:
  'Air_Stripper.Rmd' 'Comparing_Manningtrap.Rmd'
  'Comparing_Saturated_Vapor_Pressures.Rmd'
  'Construction_Measurement_Examples.Rmd'
  'Engineering_Survey_Examples.Rmd'
  'Friction_Loss_Calculation_Examples.Rmd'
  'GNU-Octave_Rem_Mod_fractdiff_Examples.Rmd'
  'GNU-Octave_cosd_Function_Examples.Rmd'
  'GNU-Octave_size_Function_Examples.Rmd'
  'Open-Channel-Flow_Examples_Geometric_Shapes.Rmd'
  'Reynolds_number_Calculation_Examples.Rmd'
  'secprop_R_GNU-Octave_Example.Rmd'

Error: Vignette re-building failed.
Execution halted