I found a better function for our purposes inside the package reshape2. They have a melt function that does most of the work for us, but includes the 0's and doesn't flip out with negatives.
You don't need to write comments for everything. So, for example, a comment saying "use function barry" isn't necessary - just go ahead and use the function. I try to think of comments as introducing "paragraphs" of code, and that the "sentences" should be reasonably self-explanatory within those paragraphs. It's hard to learn what needs commenting and what doesn't, so don't sweat it too much
It's good that you're commenting arguments and return values, but it would be better to put them in roxygen2 format. I go through this in the handout that I sent you, but in my commit you can see how I've pushed your comments into that format. Also take a look at nacdb.R for more examples of it.
I found a better function for our purposes inside the package reshape2. They have a melt function that does most of the work for us, but includes the 0's and doesn't flip out with negatives.
Also, I adjusted one of the error messages.