Skip to content

Commit

Permalink
document make_ganttchart()
Browse files Browse the repository at this point in the history
  • Loading branch information
janneadolf committed Oct 3, 2024
1 parent 5688b72 commit 56b6e79
Showing 1 changed file with 37 additions and 3 deletions.
40 changes: 37 additions & 3 deletions source/functions/make_ganttchart.R
Original file line number Diff line number Diff line change
@@ -1,16 +1,50 @@
make_ganttchart <- function(
data_sheet,
col_var,
cols4all_palette = "carto.pastel",
phase_no_plot = 1,
show_tasks_withoutdate = FALSE,
tasklabel_textsize = 3,
tasklabel_linebreak_nchar = 20,
show_brackets = TRUE,
brackets_vjust = -0.6,
brackets_distance = 2,
barwidth_scalingfactor = 5,
cols4all_palette = "carto.pastel"
) {
barwidth_scalingfactor = 5
) {
#' Make a Gantt chart from a data sheet
#'
#' @description \code{make_ganttchart} creates a Gantt chart from a data sheet containing planning information. The function is currently limited as it is tailored to a specific google data sheet \href{https://docs.google.com/spreadsheets/d/1HpDGXbUmCl_KNabdHB9ESW59m6Wc2x1ccQ8uEktDcRY/edit?usp=sharing}{website} and does (partly) not generalize beyond it.

Check warning on line 16 in source/functions/make_ganttchart.R

View workflow job for this annotation

GitHub Actions / check project with checklist

file=source/functions/make_ganttchart.R,line=16,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 358 characters.
#'
#' @param data_sheet A tibble or data.frame containing the content of the data sheet.

Check warning on line 18 in source/functions/make_ganttchart.R

View workflow job for this annotation

GitHub Actions / check project with checklist

file=source/functions/make_ganttchart.R,line=18,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 87 characters.
#' @param col_var A character string giving the name of the variable in data_sheet that should be mapped to the task bar (\code{\link[ggplot2]{geom_segment}}) color.

Check warning on line 19 in source/functions/make_ganttchart.R

View workflow job for this annotation

GitHub Actions / check project with checklist

file=source/functions/make_ganttchart.R,line=19,col=81,[line_length_linter] Lines should not be more than 80 characters. This line is 167 characters.
#' @param cols4all_palette A character string giving the name of the palette to be used from the package \href{https://cran.r-project.org/web/packages/cols4all/}{cols4all}.
#' @param phase_no_plot A numeric string or vector providing the index number(s) of the phase(s) to be plotted. Assumes a variable named "phase_no" in data_sheet assuming those numeric value(s).
#' @param show_tasks_withoutdate A logical value to control whether tasks without start and end dates should be plotted.
#' @param tasklabel_textsize A number providing the desired size of the task labels in the chart. All text element sizes are adjusted relative to this size.
#' @param tasklabel_linebreak_nchar A number providing the number of characters after which a line break should be inserted into a task label.
#' @param show_brackets A logical value to control whether nested curly brackets should be added to the chart to visually organize the tasks. Assumes variables named "element", "block" and "step" for creating the brackets.
#' @param brackets_vjust A number providing the vertical justification of the bracket titles relative to the brackets.
#' @param brackets_distance A number providing the distance between the nested brackets.
#' @param barwidth_scalingfactor A number providing the scaling factor for the width of task bar (\code{\link[ggplot2]{geom_segment}}).
#'
#' @return A ggplot object.
#'
#' @examples
#'
#' \dontrun{
#' make_ganttchart(
#' data_sheet = data_sheet,
#' col_var = "responsible",
#' tasklabel_textsize = 9,
#' tasklabel_linebreak_nchar = 100,
#' brackets_vjust = -1,
#' brackets_distance = 7,
#' barwidth_scalingfactor = 10,
#' show_tasks_withoutdate = FALSE
#' )
#' }
#'
#' @export
require("data.table") # for :=
require("rlang") # for .data$variale
#
Expand Down

0 comments on commit 56b6e79

Please sign in to comment.