sch_add_activities {criticalpath} | R Documentation |
Add Activities
Description
Combine several vectors for activities and their attributes into a tibble, which can be combined with other similarly-generated tibbles, resulting in unique tibble to be added in a schedule. If the schedule already contain some activities, the new activities will be added in the end.
Usage
sch_add_activities(sch, id, name, duration, ...)
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. |
... |
One or more vectors for associated activity attributes. |
Details
A activity tibble, or atb, has at least the following columns:
-
id
(of typeinteger
): Activity id. It is an integer number that must be unique within a schedule. -
name
(of typecharacter
): Activity name. It may be empty string. -
duration
(of typeinteger
): Activity duration. It is integer number without unit time. It may be zero.
An arbitrary number of additional columns containing data attributes can be part of the atb, so long as they follow the aforementioned columns.
Value
A schedule with a activity tibble (atb) added.
See Also
sch_reference()
, sch_add_relations()
, sch_add_activity()
,
sch_title()
, sch_nr_activities()
, sch_new()
, sch_plan()
,
sch_get_activity()
, sch_has_any_activity()
,
sch_change_activities_duration()
.
Examples
# Example #1
sch <- sch_new() %>%
sch_add_activities(
id = 1:17,
name = paste("a", as.character(1:17), sep=""),
duration = c(1L,2L,2L,4L,3L,3L,3L,2L,1L,1L,2L,1L,1L,1L,1L,2L,1L)
) %>%
sch_plan()
sch_duration(sch)
sch_activities(sch)
# Example #2
sch <- sch_new() %>%
sch_add_activities(
id = 1:17,
name = paste("a", as.character(1:17), sep=""),
duration = c(1L,2L,2L,4L,3L,3L,3L,2L,1L,1L,2L,1L,1L,1L,1L,2L,1L),
resource = "Rubens",
cost = 123.45
) %>%
sch_plan()
sch_duration(sch)
atb <- sch_activities(sch)
atb$resource
atb$cost
# Example #3
sch <- sch_new() %>%
sch_add_activities(
id = 1:17,
name = paste("a", as.character(1:17), sep=""),
duration = c(1L,2L,2L,4L,3L,3L,3L,2L,1L,1L,2L,1L,1L,1L,1L,2L,1L),
resource = c(
"Rubens", "Jose", "Rosa", "Rodrigues", "Silva",
"Rubens", "Jose", "Rosa", "Rodrigues", "Silva",
"Rubens", "Jose", "Rosa", "Rodrigues", "Silva",
"Rubens", "Jose"),
cost = c(
123.45, 234.56, 345.56, 456.78, 567.89,
123.45, 234.56, 345.56, 456.78, 567.89,
123.45, 234.56, 345.56, 456.78, 567.89,
123.45, 234.56)
) %>%
sch_plan()
sch_duration(sch)
atb <- sch_activities(sch)
atb$resource
atb$cost