A dependency budget keeps optional package adoption small and reviewable.

Program

Play the script to change the number of optional packages under consideration.

optional_count
dependency_budget.R
Replay: real traced execution (multi-file project)
optional_count <- 2
base_tools <- c("base", "stats")
optional_tools <- c("readr", "ggplot2", "shiny", "targets")
chosen <- head(optional_tools, optional_count)
total <- length(base_tools) + length(chosen)
label <- paste("tools", total, sep = ":")
cat(label, "\n", sep = "")
optional_count <- 1
base_tools <- c("base", "stats")
optional_tools <- c("readr", "ggplot2", "shiny", "targets")
chosen <- head(optional_tools, optional_count)
total <- length(base_tools) + length(chosen)
label <- paste("tools", total, sep = ":")
cat(label, "\n", sep = "")
optional_count <- 4
base_tools <- c("base", "stats")
optional_tools <- c("readr", "ggplot2", "shiny", "targets")
chosen <- head(optional_tools, optional_count)
total <- length(base_tools) + length(chosen)
label <- paste("tools", total, sep = ":")
cat(label, "\n", sep = "")
  1. optional_count ← 2

    1optional_count <- 22base_tools <- c("base", "stats")
    values this step2optional_count
  2. base_tools ← base, stats

    1optional_count <- 22base_tools <- c("base", "stats")3optional_tools <- c("readr", "ggplot2", "shiny", "targets")
    values this stepbase, statsbase_tools
  3. optional_tools ← readr, ggplot2, shiny, targets

    2base_tools <- c("base", "stats")3optional_tools <- c("readr", "ggplot2", "shiny", "targets")4chosen <- head(optional_tools, optional_count)
    values this stepreadr, ggplot2, shiny, targetsoptional_tools
  4. chosen ← readr, ggplot2

    3optional_tools <- c("readr", "ggplot2", "shiny", "targets")4chosen <- head(optional_tools, optional_count)5total <- length(base_tools) + length(chosen)
    values this stepreadr, ggplot2chosenreadr, ggplot2, shiny, targetsoptional_tools2optional_count
  5. total ← 4

    4chosen <- head(optional_tools, optional_count)5total <- length(base_tools) + length(chosen)6label <- paste("tools", total, sep = ":")
    values this step4totalbase, statsbase_toolsreadr, ggplot2chosen
  6. label ← tools:4

    5total <- length(base_tools) + length(chosen)6label <- paste("tools", total, sep = ":")7cat(label, "\n", sep = "")
    values this steptools:4label4total
  7. cat(label, " ", sep = "")

    6label <- paste("tools", total, sep = ":")7cat(label, "\n", sep = "")
    outputtools:4
    values this steptools:4label
  1. optional_count ← 1

    1optional_count <- 12base_tools <- c("base", "stats")
    values this step1optional_count
  2. base_tools ← base, stats

    1optional_count <- 12base_tools <- c("base", "stats")3optional_tools <- c("readr", "ggplot2", "shiny", "targets")
    values this stepbase, statsbase_tools
  3. optional_tools ← readr, ggplot2, shiny, targets

    2base_tools <- c("base", "stats")3optional_tools <- c("readr", "ggplot2", "shiny", "targets")4chosen <- head(optional_tools, optional_count)
    values this stepreadr, ggplot2, shiny, targetsoptional_tools
  4. chosen ← readr

    3optional_tools <- c("readr", "ggplot2", "shiny", "targets")4chosen <- head(optional_tools, optional_count)5total <- length(base_tools) + length(chosen)
    values this stepreadrchosenreadr, ggplot2, shiny, targetsoptional_tools1optional_count
  5. total ← 3

    4chosen <- head(optional_tools, optional_count)5total <- length(base_tools) + length(chosen)6label <- paste("tools", total, sep = ":")
    values this step3totalbase, statsbase_toolsreadrchosen
  6. label ← tools:3

    5total <- length(base_tools) + length(chosen)6label <- paste("tools", total, sep = ":")7cat(label, "\n", sep = "")
    values this steptools:3label3total
  7. cat(label, " ", sep = "")

    6label <- paste("tools", total, sep = ":")7cat(label, "\n", sep = "")
    outputtools:3
    values this steptools:3label
  1. optional_count ← 4

    1optional_count <- 42base_tools <- c("base", "stats")
    values this step4optional_count
  2. base_tools ← base, stats

    1optional_count <- 42base_tools <- c("base", "stats")3optional_tools <- c("readr", "ggplot2", "shiny", "targets")
    values this stepbase, statsbase_tools
  3. optional_tools ← readr, ggplot2, shiny, targets

    2base_tools <- c("base", "stats")3optional_tools <- c("readr", "ggplot2", "shiny", "targets")4chosen <- head(optional_tools, optional_count)
    values this stepreadr, ggplot2, shiny, targetsoptional_tools
  4. chosen ← readr, ggplot2, shiny, targets

    3optional_tools <- c("readr", "ggplot2", "shiny", "targets")4chosen <- head(optional_tools, optional_count)5total <- length(base_tools) + length(chosen)
    values this stepreadr, ggplot2, shiny, targetschosenreadr, ggplot2, shiny, targetsoptional_tools4optional_count
  5. total ← 6

    4chosen <- head(optional_tools, optional_count)5total <- length(base_tools) + length(chosen)6label <- paste("tools", total, sep = ":")
    values this step6totalbase, statsbase_toolsreadr, ggplot2, shiny, targetschosen
  6. label ← tools:6

    5total <- length(base_tools) + length(chosen)6label <- paste("tools", total, sep = ":")7cat(label, "\n", sep = "")
    values this steptools:6label6total
  7. cat(label, " ", sep = "")

    6label <- paste("tools", total, sep = ":")7cat(label, "\n", sep = "")
    outputtools:6
    values this steptools:6label
budget `optional_count` limits how many optional dependencies are being considered.
base tools Built-in tools are tracked separately from optional package labels.
review count The total count gives reviewers a quick size check.