init_project: Set up new project repository

View source: R/init_project.R

init_projectR Documentation

Set up new project repository

Description

Creates a folder structure and sets up basic functionality.

Usage

init_project(
  x,
  path = ".",
  pkg_structure = TRUE,
  fields = NULL,
  git = TRUE,
  targets = TRUE,
  docker = TRUE,
  quarto = TRUE
)

Arguments

x

Character. Name of project repository.

path

A path. If it exists, it is used. If it does not exist, it is created, provided that the parent path exists.

pkg_structure

Logical. Whether to add R-package infrastructure.

fields

A named list of fields to add to DESCRIPTION, potentially overriding default values. See use_description() for how you can set personalized defaults using package options.

git

Logical. Whether to initialize git.

targets

Logical. Whether to set up targets infrastructure.

docker

Logical. Whether to configure a default Docker container. For details see http://frederikaust.com/papaja_man/tips-and-tricks.html#docker

quarto

Logical. Wether to use quarto for reproducible reporting, or R Markdown.

Details

When using targets keep the following in mind: First, customize _targets.yaml (e.g., customize project name and file paths). Remote parallelization requires the future package. Local parallelization should work out of the box. For parallelization on the Methexp cluster, set the right hostname or IP for master (i.e. your IP) in _targets.R, and the cluster computers (these should be set to the correct static IP by default). If your targets perform parallel computations (e.g., MCMC chain parallelization in rstan), set cores = 1L in methexp_cluster() to avoid spawning too many jobs due to the nested parallelization. Make sure that all cluster computers have future and targets installed, otherwise you'll get hard-to-understand errors about missing packages or scheduler problems.

Finally, if you use rstan, you may want to compile your models first and sample in separate targets. If you parallelize on the Methexp cluster, you may want to compile locally by setting deployment = "main" in the targets plan and set rstan_options(auto_write = TRUE) to avoid unnecessary model recompilation.


crsh/template documentation built on Dec. 5, 2023, 6:31 p.m.