isBefore: Check relations between elements: isBefore, isAfter,...

Description Usage Arguments Details Value Examples

View source: R/gantt.R

Description

Check relations between elements: isBefore, isAfter, isOverlap, noOverlap, isFirst, isLast

Title

Usage

 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
isBefore(
  gantt,
  a = gantt$names[1],
  b = gantt$names[2],
  which.a = "all",
  which.b = "all",
  orEqual = FALSE,
  strict = TRUE,
  strictAfter = TRUE
)

isFirst(
  gantt,
  a = gantt$names[1],
  which = "all",
  orEqual = FALSE,
  strict = TRUE
)

isAfter(
  gantt,
  a = gantt$names[1],
  b = gantt$names[2],
  which.a = "all",
  which.b = "all",
  orEqual = FALSE,
  strict = TRUE
)

isLast(
  gantt,
  a = gantt$names[1],
  which = "all",
  orEqual = FALSE,
  strict = TRUE
)

isOverlap(
  gantt,
  a = gantt$names[1],
  b = gantt$names[2],
  which.a = "any",
  which.b = "any"
)

noOverlap(gantt, a = gantt$names[1], b = gantt$names[1])

Arguments

gantt

gantt object (from makeGantt).

a

element or elements in the gantt chart (character or vector of characters).

b

element or elements (character or vector of characters).

which.a, which.b

"all": consider all slots of a/b, "first": only consider the first slot of a/b, "last": only consider the last slot of a/b. If which.a/which.b is a number n, the n'th slot is used in the comparison.

orEqual

if TRUE, a and b can be at the same time (not just before/after).

strict

if FALSE, an element a is considered before/after even though b is not present.

which

"all": consider all slots of element, "first": only consider the first slot of element, "last": only consider the last slot of element. If which is a number n, the n'th slot is used in the comparison.

which.a/which.b

for isOverlap: any: one or more a/b elements overlap, all: all a/b elements need to overlap, first/first: First a/b needs to overlap, last/last: Last a/b needs to overlap, or use number (or sequence)

Details

In these functions a and b are compared. Which.a and which.b decides which parts of a an b take part in the comparison. If which.a is "all", all the slots of a are compared to the which.b slots. If which.a is "first", only the first slot of a is considered in the comparison. If which.b is "last", only the last slot of a is considered in the comparison. The same goes for which.b: if b is "all", all slots of b are considered, if b is "first" or "last", only the first/last slot is considered in the comparison. For example, in isBefore, if which.a is "first" and which.b is last, the first slot of a needs to be before the last slot of b.

In practice this means that for isBefore, when a is "all", the last slot of a is compared to b, and when b is "all", the first slot of b i compared to a.

orEqual relaxes the condition of before or after, first or last, so the selected parts of a and b can be overlapping as well. This result in that which.a="all" and orEqual=T means that the last slot are allowed to overlap.

Value

When stict is TRUE, returns 0 when b is not set, when strict is FALSE, a is before b, when b is not set.

Examples

1
2
3
4
5
6
7
8
9
response<-"{'response':'1/8 10:30 - 1/8 13:00;1/8 13:00 - 1/8 14:00;1/8 11:30 - 1/8 12:30'}"
gantt<-makeGantt(response,names=c("waitress","actor","pianist"),timespan=30,time.format="%d/%m %H:%M")
isBefore(gantt,"waitress",c("actor"),which.a = "first",which.b = "first")
isBefore(gantt,"waitress",c("actor"),which.a = "all",which.b = "first")
isBefore(gantt,"waitress",c("actor"),which.a = "all",which.b = "first",orEqual = TRUE)
isAfter(gantt,c("pianist","actor"),c("waitress"),which.a = "last",which.b = "all")
isLast(gantt,"waitress")
isFirst(gantt,"waitress",which="first")
isOverlap(gantt,"actor","waitress")

openPCI/OpenPCIScoring documentation built on June 10, 2021, 1:18 p.m.