Added function rpin with tests 

Also moved the test files according to a new standard for testthat (https://github.com/hadley/testthat).