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