I got an error message and a warning message when I ran the last line of code. They were copied here:
Error in width/2 : non-numeric argument to binary operator
In addition: Warning message:
In mean.default(width) : argument is not numeric or logical: returning NA
Indeed, I carefully read through the code but did not see either width/2 or mean.default (width). Would you be able to help on this?