This function will create an unordered list of all the files in a directory and print the output. It should be used in conjunction with RMarkdown and knitr. Specifically, you want to call it within an R chunk that has the results set to 'asis'.

print_dir_ul(path = ".", remove = NULL, nested = FALSE)

Arguments

path

The path to the directory of which you want to print the structure

remove

A regular expression to subset the output

nested

(logical) If false, creates unordered list of current directory only. Otherwise, subdirectories within current directory (1 level) are also included in the list.

Examples

# In any directory print_dir_ul()
#> - count_words.html #> - create_project.html #> - give_n_digits.html #> - index.html #> - mod_to_table.html #> - myProject #> - normal_approximation.html #> - print_builder.html #> - print_dir_ul.html #> - print_model_param.html #> - print_model_params_p.html #> - print_model_params.html #> - print_nmc_p.html #> - print_pval.html #> - round_pval.html #> - Rplot001.png
# To specify the path print_dir_ul(path = "./")
#> - count_words.html #> - create_project.html #> - give_n_digits.html #> - index.html #> - mod_to_table.html #> - myProject #> - normal_approximation.html #> - print_builder.html #> - print_dir_ul.html #> - print_model_param.html #> - print_model_params_p.html #> - print_model_params.html #> - print_nmc_p.html #> - print_pval.html #> - round_pval.html #> - Rplot001.png
# All files that are not .txt print_dir_ul(remove = ".txt")
#> - count_words.html #> - create_project.html #> - give_n_digits.html #> - index.html #> - mod_to_table.html #> - myProject #> - normal_approximation.html #> - print_builder.html #> - print_dir_ul.html #> - print_model_param.html #> - print_model_params_p.html #> - print_model_params.html #> - print_nmc_p.html #> - print_pval.html #> - round_pval.html #> - Rplot001.png