# no datageneration
In the same topic as previous exercise, list all files in all subfolders in the directory containing the files for the different packages (see command Sys.getenv('R_LIBS_USER')
). On average, how many files are needed for each package?
r_pkg_folder <- Sys.getenv ('R_LIBS_USER') pkg_files <- list.files(r_pkg_folder, recursive = TRUE) my_dirs <- list.dirs(r_pkg_folder, recursive = FALSE) n_files <- length(pkg_files) n_dirs <- length(my_dirs) my_msg <- paste0('We have ', length(pkg_files), ' ', 'files for ', length(my_dirs), ' packages. \n', 'On average, there are ', n_files/n_dirs, ' files per directory.') message(my_msg)
extype: string
exsolution: r mchoice2string(c(TRUE, FALSE, FALSE, FALSE, FALSE), single = TRUE)
exname: "install pkgs"
exshuffle: TRUE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.