sampling functions for wtatage

I believe that it is working, and I created an Rcode directory.