Create a Gantt chart using ganttrify

R

This post shows you how to create a Gantt chart using the R package ganttrify. First, install the package from GitHub.

# install.packages("remotes")
remotes::install_github("giocomai/ganttrify")

Here I’m going to use a sample project table like this:

project <- data.frame(
  c("1. Project A", "1. Project A", "1. Project A", "2. Project B", "2. Project B", "2. Project B"),
  c("1.1. Task A", "1.2. Task B", "1.3. Task C", "2.1. Task A", "2.2. Task B", "2.3. Task C"),
  c(1, 2, 4, 1, 1, 3),
  c(1, 3, 4, 2, 2, 5)
)
colnames(project) = c("wp", "activity", "start_date", "end_date")
wpactivitystart_dateend_date
1. Project A1.1. Task A11
1. Project A1.2. Task B23
1. Project A1.3. Task C44
2. Project B2.1. Task A12
2. Project B2.2. Task B12
2. Project B2.3. Task C25

Note that you have to set the column names as wp, activity, start_date, and end_date. Now you are ready to create a Gantt chart by running the following code:

ganttrify(project = project, project_start_date = "2020-07")

You can specify the exact date like this:

project <- data.frame(
  c("1. Project A", "1. Project A", "1. Project A", "2. Project B", "2. Project B", "2. Project B"),
  c("1.1. Task A", "1.2. Task B", "1.3. Task C", "2.1. Task A", "2.2. Task B", "2.3. Task C"),
  c("2020-07-01", "2020-07-13", "2020-07-01", "2020-07-01", "2020-07-13", "2020-07-27"),
  c("2020-07-10", "2020-08-21", "2020-07-28", "2020-07-10", "2020-07-24", "2020-08-14")
)
colnames(project) = c("wp", "activity", "start_date", "end_date")
ganttrify(project = project, by_date = TRUE, exact_date = TRUE, month_number = FALSE)

You can find more information about this package on its GitHub page.

Comments

Copied title and URL