sch_add_activity: Add Activity

Description Usage Arguments Value See Also Examples

View source: R/sch_activity.R

Description

Add an activity and her relations to a schedule. The relations are optional. They will be included if a set of activity id is informed, after activity duration.

Usage

1
sch_add_activity(sch, id, name, duration, ..., direction = "succ")

Arguments

sch

A schedule object.

id

Activity id that will be used to make relation between activities. It must be unique.

name

The name of activity.

duration

A number that represents the activity's duration. It must be equal or greater than zero.

...

A set of activity id relation such that will be linked with activity id. It may be relations of successor or predecessors.

direction

Direction of relations: It may be "succ" or "pred".

  • succ: The relations_id will be the successor of the activity.

  • pred: The relations_id will be the predecessor of the activity.

Value

A Schedule object with an activity added to it. If relations id is present, it will be included to the schedule.

See Also

sch_change_activities_duration(), sch_has_any_activity(), sch_new(), sch_add_activities(), sch_get_activity(), sch_plan(), sch_nr_activities(), sch_add_relation().

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Example #1: Only with activities
sch <- sch_new() %>%
  sch_add_activity(1L, "Task 1", 5L) %>%
  sch_add_activity(2L, "Task 2", 6L) %>%
  sch_add_activity(3L, "Task 3", 8L) %>%
  sch_add_activity(4L, "Task 4", 6L) %>%
  sch_add_activity(5L, "Task 5", 9L) %>%
  sch_add_activity(6L, "Task 6", 3L) %>%
  sch_add_activity(7L, "Task 7", 4L) %>%
  sch_plan()
sch_duration(sch)
sch_activities(sch)

# Example #2: With activities and relations.
sch <- sch_new() %>%
  sch_add_activity(1L, "Task 1", 5L, 2L, 3L) %>%
  sch_add_activity(2L, "Task 2", 6L, 4L) %>%
  sch_add_activity(3L, "Task 3", 8L, 5L) %>%
  sch_add_activity(4L, "Task 4", 6L, 6L) %>%
  sch_add_activity(5L, "Task 5", 9L, 6L) %>%
  sch_add_activity(6L, "Task 6", 3L, 7L) %>%
  sch_add_activity(7L, "Task 7", 4L) %>%
  sch_plan()
sch_duration(sch)
sch_activities(sch)
sch_relations(sch)

rubens2005/criticalpath documentation built on Feb. 6, 2022, 10:54 p.m.