R functions — writing and developing