added drafts of R functions