Description Usage Arguments Note Author(s) See Also
View source: R/project_framework.R
This function is probably the only function of the whole package 'framework' you need to call by hand. It is a wrapper for skeleton, Rproj_init and git_init. Therefore it is straightforward to create a new project, change the working directory, generate basic directories/files and initialize a git repository. Optionally you can initialize a packrat repo.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | project_framework(project_dir, devtools_create = FALSE, rstudio = TRUE,
init_git = TRUE, init_packrat = FALSE,
input_files = c("load_data.R"), pkg_cran_install = c("utils",
"tools", "rmarkdown", "knitr", "rstudioapi"),
pkg_cran_load = c("tidyverse"), pkg_gh_install = NULL,
pkg_gh_load = NULL, input_dir = "files", data_dir = "data/in",
cache_dir = ".cache", fun_dir = "R", spin_index = 0,
cache_index = 999, symlink_dir_input = "in",
symlink_dir_docs = "out/docs", symlink_dir_figure = "out",
rename_symlink_input = TRUE, rename_symlink_docs = TRUE,
rename_symlink_figure = TRUE, rebuild_figures = TRUE,
Rplots_device = "grDevices::png", target_dir_data = "data/out",
listofdf = "GlobalEnv", data_extension = "RData",
rebuild_target_dir_data = TRUE,
filepath_session_info = "meta/session_info.txt",
filepath_log = "meta/log.csv", filepath_tree = "meta/tree.txt",
filepath_warnings = "meta/warnings.Rout", tree_directory = "getwd()",
include_hidden_tree = FALSE, filepath_pkg_bib = "meta/pkg.bib",
filepath_image = ".RData", autobranch = NULL,
quiet_processing = TRUE, summarize_session_info = FALSE,
summarize_df = FALSE, summarize_memory = FALSE,
summarize_log = FALSE, summarize_git = TRUE,
summarize_tree = FALSE, summarize_warnings = FALSE)
|
project_dir |
Character. Specify the path to the directory where you want to create a new project. The last directory will be the top level of the project and additionally the name of your project. E.g. '~/Desktop/MyProject' will create a project called 'MyProject'. |
devtools_create |
Logical. Choose TRUE if you want to call 'devtools::create()' in order to prepare your project as an R-package. You might want to choose appropriate paths for other variables (e.g. fun_dir = 'R', data_dir = inst/extdata, and so on). See alias 'package |
rstudio |
Logical. TRUE calls the function Rproj_init. |
init_git |
Logical. TRUE calls the function git_init. |
init_packrat |
Logical. TRUE initializes a packrat repo. |
input_files |
character vector. File paths to your input files. Should be found within the directory 'input dir'. Use file extension 'R' or 'Rmd'. |
pkg_cran_install |
Character vector. Package names that should be installed from your default cran mirror. |
pkg_cran_load |
Character vector. Package names that should be installed from your default cran mirror and additionally loaded. |
pkg_gh_install |
Character vector. Package names that should be installed from github. Depends on the package 'devtools'. |
pkg_gh_load |
Character vector. Package names that should be installed from github and additionally loaded. Depends on the package 'devtools'. |
input_dir |
Character. Source directory for your input_files. |
data_dir |
Character. Source directory for raw data. This directory will be monitored. When files change in this directory the cache will be ignored (when using the framework template of the file 'make.R'). |
cache_dir |
Character. Directory for the cache. |
fun_dir |
Character. Directory for user-written functions. When using the framework template of the file 'make.R' all R-Scripts (functions) within this directory will be attached to a predefined environment. |
spin_index |
Integer vector. Subset of input_files that should be spinned. Files extensions other than '.R' will be ignored. (0 = none, 999 = all) |
cache_index |
Integer vector. Subset of input_files that should be cached. (0 = none, 999 = all) |
symlink_dir_input |
Character. Target directory for symbolic links to input_files. Should betreated as read-only. |
symlink_dir_docs |
Character. Target directory for symbolic links to rendered files. Should betreated as read-only. |
symlink_dir_figure |
Character. Target directory for symbolic links to rendered figures. Should betreated as read-only. |
rename_symlink_input |
Logical. Preserve directory structure and filename or collapse directories and rename symbolic links. |
rename_symlink_docs |
Logical. Preserve directory structure and filename or collapse directories and rename symbolic links. |
rename_symlink_figure |
Logical. Preserve directory structure and filename or collapse directories and rename symbolic links. |
rebuild_figures |
Logical. Delete figures before rendering. Choose FALSE if you want to use knitr::cache. |
Rplots_device |
Character. Function that should be passed to write figures of R-files if sourced. E.g. 'grDevices::pdf' or 'grDevices::png'. Choose NULL if you want to write figures manually (e.g. using ggsave for ggplot2-graphics). |
target_dir_data |
Character. Target directory for data. |
listofdf |
Character vector. Specify a vector of dataframes to write. Choose 'GlobalEnv' to write all data frames currently inside your global environment. |
data_extension |
Character. Specify file extension for data frames. Possible values: 'csv', 'RData' and 'rds'. |
rebuild_target_dir_data |
Logical. Delete target_dir_data before writing current data frames. |
filepath_session_info |
Character. Specify file path to write the session info file. |
filepath_log |
Character. Specify file path to write the log file. |
filepath_tree |
Character. Specify file path to write the tree file. |
filepath_warnings |
Character. Specify file path to write the warnings file. |
tree_directory |
Character. Specify input directory as top level for the tree. |
include_hidden_tree |
Logical. Include/Exclude hidden directories and files to build the tree. |
filepath_pkg_bib |
Character. Target filepath to write bib-file of packages. See ?knitr::write_bib() |
filepath_image |
Character. Target filepath to write final image. |
autobranch |
Character. Specify the name of an existing branch. Only if HEAD is pointing to this branch an auto-snapshot will be created. Exception: Choose NULL (default) to ignore branch-dependency. |
quiet_processing |
Logical. Specify if processing of files should be quiet. |
summarize_session_info |
Logical. Should session info be printed to console? |
summarize_df |
Logical. Should a list of written data frames be printed to console? |
summarize_memory |
Logical. Should memory usage be printed to console? |
summarize_log |
Logical. Should a summary of the log file be printed to console? Depends on dplyr. |
summarize_git |
Logical. If TRUE git2r::summary() will be called. |
summarize_tree |
Logical. Should the directory structure (tree) be printed to console? |
summarize_warnings |
Logical. Should filepath_warnings be printed to console? |
Creation of the project_dir is recursive.
Frederik Sachser
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.