Home

Awesome

addinit

Addin for initializing new projects in RStudio

<!-- badges: start -->

Lifecycle: stable R-CMD-check

<!-- badges: end -->

Overview

This addin provide a Shiny gadget to easily create directories and scripts from templates in your new RStudio project !

Installation :

# From Github
# install.packages("devtools")
devtools::install_github("dreamRs/addinit")

To launch the addin, use the addin menu in RStudio.

Customization

You can customize a lot of options in addinit, for example the names of the directories to create or a default author for the scripts. For this just modify the parameters list below and set the option addinit in your .Rprofile.

my_custom_params <- list(
  author = NULL,
  project = list(
    folders = list(
      default = c("scripts", "datas", "funs", "inputs", "outputs", "logs"),
      selected = NULL
    ),
    packages = list(
      default = rownames(installed.packages()),
      selected = NULL
    ),
    config = TRUE,
    source_funs = FALSE
  ),
  application = list(
    folders = list(
      default = c("datas", "funs", "modules", "www"),
      selected = NULL
    ),
    packages = list(
      default = rownames(utils::installed.packages()),
      selected = NULL
    ),
    create_template = TRUE,
    template = "dashboard"
  )
)
options("addinit" = my_custom_params)

For examples, changing the author and the directories' names and select package shiny by default :

my_custom_params <- list(
  author = "Victor",
  project = list(
    folders = list(
      default = c("R", "inst", "man", "data-raw", "data", "tests"),
      selected = c("R", "man")
    ),
    packages = list(
      default = rownames(utils::installed.packages()),
      selected = "shiny"
    )
  )
)
options("addinit" = my_custom_params)

<br>

Full list of parameters :

optionvaluedescription
authorcharacterThe value to use by default for author input, used when creating a script from template
folders.defaultcharacter vectorThe names of the directories to create
folders.selectedcharacter vectorSelect folders to create by default
packages.defaultcharacter vectorA vector of packages to load in scripts, by default all packages installed
packages.selectedcharacter vectorSelect packages to load by default
configlogicalAdd a config script or not at the root of the projects for loading data, sourcing funs,...
source_funslogicalAdd code to source functions
create_templatelogicalMake Shiny template selection appear
templatecharacterTemplate to create, shiny for a classic shiny app (ui, server, global), dashboard for use shinydashboard, miniapp for a single file app (app.R)