Most functions’ docstring have (follows by the description of input, one input variable per line), (follow by the description of what the function returns), (follows by an example usage of the function). To do this, we would need to write docstrings in a specific way for each function before defining it. Here we want to use roxygen2 package to generate markdown page for each function, the markdown files will be saved in man and can be accessed by ?function_name. Use_test() # create unit test template, you can add some test cases My_func_with_dplyr <- function(df, col_name) Use_r("my_func_with_ dplyr") #creates 'R/my_func_with_dplyr.R' Use_package("dplyr") #adds "dplyr" to Imports field in DESCRIPTION
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |