-
-
Notifications
You must be signed in to change notification settings - Fork 155
/
sampleData.R
91 lines (87 loc) · 3.09 KB
/
sampleData.R
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# Simple timeline with 4 items
dataBasic <- data.frame(
content = c("Item one", "Item two" ,"Ranged item", "Item four"),
start = c("2016-01-10", "2016-01-11", "2016-01-20", "2016-02-14"),
end = c(NA, NA, "2016-02-04", NA)
)
countryToCode <- list(
"Argentina" = "ar",
"Belgium" = "be",
"Brazil" = "br",
"Colombia" = "co",
"Costa Rica" = "cr",
"France" = "fr",
"Germany" = "de",
"Netherlands" = "nl"
)
# Template for world cup HTML of each item
templateWC <- function(stage, team1, team2, score1, score2) {
sprintf(
'<table><tbody>
<tr><td colspan="3"><em>%s</em></td></tr>
<tr>
<td>%s</td>
<th> %s - %s </th>
<td>%s</td>
</tr>
<tr>
<td><img src="https://flagpedia.net/data/flags/mini/%s.png" width="31" height="20" alt="%s"></td>
<th></th>
<td><img src="https://flagpedia.net/data/flags/mini/%s.png" width="31" height="20" alt="%s"></td>
</tr>
</tbody></table>',
stage, team1, score1, score2, team2, countryToCode[[team1]], team1, countryToCode[[team2]], team2
)
}
# Data for world cup 2014
dataWC <- data.frame(
start = c(
"2014-07-04 13:00",
"2014-07-04 17:00",
"2014-07-05 13:00",
"2014-07-05 17:00",
"2014-07-08 17:00",
"2014-07-09 17:00",
"2014-07-13 16:00"
),
content = c(
templateWC("quarter-finals", "France", "Germany", 0, 1),
templateWC("quarter-finals", "Brazil", "Colombia", 2, 1),
templateWC("quarter-finals", "Argentina", "Belgium", 1, 0),
templateWC("quarter-finals", "Netherlands", "Costa Rica", "0 (4)", "0 (3)"),
templateWC("semi-finals", "Brazil", "Germany", 1, 7),
templateWC("semi-finals", "Netherlands", "Argentina", "0 (2)", "0 (4)"),
templateWC("final", "Germany", "Argentina", 1, 0)
),
goalsHome = c(0, 2, 1, 4, 1, 2, 1),
goalsAway = c(1, 1, 0, 3, 7, 4, 0)
)
# Data for groups example (this data also gets exported in the package)
timevisData <- data.frame(
content = c(
"Open", "Open", "Half price entry",
"Open", "Adults only", "Open", "Staff meeting",
"Open", "Men only", "Women only", "Open",
"Hot water", "Very hot water",
"Siesta"),
start = c(
"2016-05-01 06:00:00", "2016-05-01 14:00:00", "2016-05-01 08:00:00",
"2016-05-01 08:00:00", "2016-05-01 14:00:00",
"2016-05-01 16:00:00", "2016-05-01 19:30:00",
"2016-05-01 08:00:00", "2016-05-01 14:00:00", "2016-05-01 16:00:00", "2016-05-01 18:00:00",
"2016-05-01 09:00:00", "2016-05-01 14:00:00",
"2016-05-01 12:00:00"),
end = c(
"2016-05-01 12:00:00", "2016-05-01 22:00:00", "2016-05-01 10:00:00",
"2016-05-01 12:00:00", "2016-05-01 16:00:00",
"2016-05-01 20:00:00", NA,
"2016-05-01 12:00:00", "2016-05-01 16:00:00", "2016-05-01 18:00:00", "2016-05-01 20:00:00",
"2016-05-01 12:00:00", "2016-05-01 17:00:00",
"2016-05-01 14:00:00"),
group = c(rep("gym", 3), rep("pool", 4), rep("sauna", 4), rep("tub", 2), NA),
type = c(rep("range", 6), "point", rep("range", 6), "background")
)
timevisDataGroups <- data.frame(
id = c("gym", "pool", "sauna", "tub"),
content = c("Gym", "Pool", "Sauna", "Hot Tub")
)