added an R file to test along with full commenting