Title: | Organising Projects |
---|---|
Description: | A system to help you organize projects. Most analyses have three (or more) main sections: code, results, and data, each with different requirements (version control/sharing/encryption). You provide folder locations and 'org' helps you take care of the details. |
Authors: | Richard Aubrey White [aut, cre] , CSIDS [cph] |
Maintainer: | Richard Aubrey White <[email protected]> |
License: | MIT + file LICENSE |
Version: | 2024.6.5 |
Built: | 2024-11-03 05:36:26 UTC |
Source: | https://github.com/csids/org |
Create example project that uses quarto with results generated outside the .qmd file
create_project_quarto_external_results(home, results)
create_project_quarto_external_results(home, results)
home |
Location of the 'home' directory. |
results |
Location of the 'results' directory. |
Create example project that uses quarto with results generated from within the .qmd file
create_project_quarto_internal_results(home, results)
create_project_quarto_internal_results(home, results)
home |
Location of the 'home' directory. |
results |
Location of the 'results' directory. |
org::initialize_project
takes in 2+ arguments.
It then saves folder locations in the return value (a new environment) and
in org::project
, which you will use in all of your subsequent code. An additional
folder will be created on the user's file system (org::project$results_today) which
corresponds to results/YYYY-MM-DD
. The sourced folders are saved into org::project$env.
initialize_project( env = new.env(), home = NULL, results = NULL, folders_to_be_sourced = "R", source_folders_absolute = FALSE, encode_from = "UTF-8", encode_to = "latin1", ... )
initialize_project( env = new.env(), home = NULL, results = NULL, folders_to_be_sourced = "R", source_folders_absolute = FALSE, encode_from = "UTF-8", encode_to = "latin1", ... )
env |
The environment that the code will be sourced into (use |
home |
The folder containing 'Run.R' and 'R/' |
results |
A folder inside |
folders_to_be_sourced |
The names of folders that live inside |
source_folders_absolute |
If |
encode_from |
Folders current encoding (only used on Windows) |
encode_to |
Folders final encoding (only used on Windows) |
... |
Other folders that you would like to reference |
For more details see the help vignette:
vignette("intro", package = "org")
Returns an environment that contains:
Folder locations
An environment called env
into which the code has been sourced into.
There is also a side effect where org::project
mirrors these values.
org::initialize_project( home = paste0(tempdir(), "/git/analyses/2019/analysis3/"), results = paste0(tempdir(), "/dropbox/analyses_results/2019/analysis3/"), raw = paste0(tempdir(), "/data/analyses/2019/analysis3/") ) org::project$results_today org::project$raw
org::initialize_project( home = paste0(tempdir(), "/git/analyses/2019/analysis3/"), results = paste0(tempdir(), "/dropbox/analyses_results/2019/analysis3/"), raw = paste0(tempdir(), "/data/analyses/2019/analysis3/") ) org::project$results_today org::project$raw
ls
command.List files and directories
Equivalent to the unix ls
command.
ls_files(path = ".", regexp = NULL)
ls_files(path = ".", regexp = NULL)
path |
A character vector of one or more paths. |
regexp |
A regular expression that is passed to |
filepaths and directory paths as a character vector
Move directory
move_directory(from, to, overwrite_to = FALSE)
move_directory(from, to, overwrite_to = FALSE)
from |
Filepath or directory path. |
to |
Filepath or directory path. |
overwrite_to |
Boolean. |
Is a package installed?
package_installed(pkg)
package_installed(pkg)
pkg |
Package name. |
Boolean. True if package is installed, false if not.
org::package_installed("data.table")
org::package_installed("data.table")
Construct path to a file or directory
path(...)
path(...)
... |
Character vectors that will be concatenated with "/" as a separator. |
Folders to be used/referenced (environment)
project
project
An object of class environment
of length 0.
Set results folder after initialization
set_results(results, proj = org::project)
set_results(results, proj = org::project)
results |
A folder inside |
proj |
The project environment (default is |
Nothing. There is a side effect where the environments proj
and org::project
have the values $results and $results_today altered.
Write text to a file
write_text( txt, file = "", header = "**THIS FILE IS CONSTANTLY OVERWRITTEN -- DO NOT MANUALLY EDIT**\r\n\r\n" )
write_text( txt, file = "", header = "**THIS FILE IS CONSTANTLY OVERWRITTEN -- DO NOT MANUALLY EDIT**\r\n\r\n" )
txt |
Text to be written |
file |
File, passed through to |
header |
Optional header that is inserted at the top of the text file |
No return value.