Title: | Organising Projects |
Version: | 2024.6.5 |
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. |
Depends: | R (≥ 3.3.0) |
License: | MIT + file LICENSE |
URL: | https://www.csids.no/org/, https://github.com/csids/org |
BugReports: | https://github.com/csids/org/issues |
Encoding: | UTF-8 |
Imports: | utils |
Suggests: | testthat, knitr, rmarkdown, rstudioapi, glue |
RoxygenNote: | 7.2.3 |
VignetteBuilder: | knitr |
Date/Publication: | 2024-06-04 22:10:02 UTC |
NeedsCompilation: | no |
Packaged: | 2024-06-04 21:58:04 UTC; raw996 |
Author: | Richard Aubrey White
|
Maintainer: | Richard Aubrey White <hello@rwhite.no> |
Repository: | CRAN |
Create example project that uses quarto with results generated outside the .qmd file
Description
Create example project that uses quarto with results generated outside the .qmd file
Usage
create_project_quarto_external_results(home, results)
Arguments
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
Description
Create example project that uses quarto with results generated from within the .qmd file
Usage
create_project_quarto_internal_results(home, results)
Arguments
home |
Location of the 'home' directory. |
results |
Location of the 'results' directory. |
Initializes project
Description
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.
Usage
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",
...
)
Arguments
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 |
Details
For more details see the help vignette:
vignette("intro", package = "org")
Value
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 whereorg::project
mirrors these values.
Examples
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
List files and directories
Equivalent to the unix ls
command.
Description
List files and directories
Equivalent to the unix ls
command.
Usage
ls_files(path = ".", regexp = NULL)
Arguments
path |
A character vector of one or more paths. |
regexp |
A regular expression that is passed to |
Value
filepaths and directory paths as a character vector
Move directory
Description
Move directory
Usage
move_directory(from, to, overwrite_to = FALSE)
Arguments
from |
Filepath or directory path. |
to |
Filepath or directory path. |
overwrite_to |
Boolean. |
Is a package installed?
Description
Is a package installed?
Usage
package_installed(pkg)
Arguments
pkg |
Package name. |
Value
Boolean. True if package is installed, false if not.
Examples
org::package_installed("data.table")
Construct path to a file or directory
Description
Construct path to a file or directory
Usage
path(...)
Arguments
... |
Character vectors that will be concatenated with "/" as a separator. |
Folders to be used/referenced (environment)
Description
Folders to be used/referenced (environment)
Usage
project
Format
An object of class environment
of length 0.
Set results folder after initialization
Description
Set results folder after initialization
Usage
set_results(results, proj = org::project)
Arguments
results |
A folder inside |
proj |
The project environment (default is |
Value
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
Description
Write text to a file
Usage
write_text(
txt,
file = "",
header = "**THIS FILE IS CONSTANTLY OVERWRITTEN -- DO NOT MANUALLY EDIT**\r\n\r\n"
)
Arguments
txt |
Text to be written |
file |
File, passed through to |
header |
Optional header that is inserted at the top of the text file |
Value
No return value.