Learn R Programming

criticalpath (version 0.2.1)

sch_gantt_matrix: Gantt Matrix

Description

Create a matrix that represents a Gantt chart, a matrix where "1" indicates that an activity is planned to be in execution. Atention: the schedule must be planned with the function sch_plan().

Usage

sch_gantt_matrix(sch)

Arguments

sch

A schedule object.

Value

A matrix where 1 indicates that an activity is in execution and 0, the activity is not executing.

Details

In this matrix, the rows represent activities, whereas the columns represents the activity execution period. So, the number of columns is equal to project duration. The cells is an integer value that indicates the activity is in execution or not.

See Also

sch_add_activities(), sch_activities(), sch_add_relations(), sch_add_relation(), sch_relations(), sch_plan(), sch_xy_gantt_matrix().

Examples

Run this code
# NOT RUN {
sch <- sch_new() %>%
  sch_add_activities(
    id        = c( 1L,  2L,  3L,  4L),
    name      = c("A", "B", "C", "D"),
    duration  = c( 2L,  3L,  1L, 2L )
  ) %>%
  sch_add_relations(
    from = c(1L, 2L, 4L, 4L),
    to   = c(3L, 3L, 1L, 2L)
  ) %>%
  sch_plan()

sch_duration(sch)
gantt <- sch_gantt_matrix(sch)
gantt

# What is the effort by time period?
colSums(gantt) # 1 1 2 2 1 1

# What is the duration by activities?
rowSums(gantt) # 2 3 1 2

# what is the S curve
cumsum(colSums(gantt))
plot(cumsum(colSums(gantt)), type="l", lwd=3)

# }

Run the code above in your browser using DataLab