Learn R Programming

criticalpath (version 0.2.1)

sch_xy_gantt_matrix: XY Gantt Matrix

Description

Transform a Gantt matrix into x, y coordinates and the weight one. Each point greater than zero in a Gantt matrix becomes a x, y coordinate. Atention: the schedule must be planned with the function sch_plan().

Usage

sch_xy_gantt_matrix(sch, gantt = NULL)

Arguments

sch

A schedule object.

gantt

A Gantt Matrix. If it is not informed, it will use gantt_matrix() before this function.

Value

A matrix with three columns: x, y and weight.

See Also

sch_relations(), sch_activities(), sch_add_activities(), sch_add_relations(), sch_add_relation(), sch_plan(), sch_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)

xyw <- sch_xy_gantt_matrix(sch)
xyw
plot(xyw[, 1:2])

# }

Run the code above in your browser using DataLab