R, after modifying a function in a package, modifications are ignored

I just come to solve the same issue. What you have to do is just restart your R session. It seems that R caches the function and it does not matter if you detach and remove (remove.packages) the package, and then install (install.packages) and load (require) it: You need to close your session, and then with your package built with the changes:

install.packages("path_to_package.tar.gz",repos=NULL,type="source")
require("package")

This worked for me. Hope it helps.