Skip to content

Commit

Permalink
Fix #57 - adds capword function to capitalise words
Browse files Browse the repository at this point in the history
  • Loading branch information
Bosse Nyström committed Nov 6, 2021
1 parent 4cfa324 commit 2d57013
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
8 changes: 8 additions & 0 deletions r-helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,11 @@ check.packages <- function(package.list) {
})
}
}

capwords <- function(s, strict = FALSE) {
cap <- function(s) paste(toupper(substring(s, 1, 1)),
{s <- substring(s, 2); if(strict) tolower(s) else s},
sep = "", collapse = " " )
sapply(strsplit(s, split = " "), cap, USE.NAMES = !is.null(names(s)))
}

7 changes: 5 additions & 2 deletions tempo.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ working.hours <- workinghours()
team.data <- fetch.tempo.teams(TEMPO_URL, TEMPO_KEY)
team.data <- subset(team.data, select = c(id, name))
knitr::kable(team.data, caption = "Teams")
knitr::kable(team.data, caption = "Teams",
col.names = capwords(names(team.data)))
if (TEMPO_TEAM != '') {
teams <- c(TEMPO_TEAM)
Expand Down Expand Up @@ -301,7 +302,9 @@ for (team.id in teams.with.data) {
name = "Delta hours [h]",
sec.axis = dup_axis())
print(knitr::kable(user.delta, caption = subset(team.data, id == team.id)$name))
print(knitr::kable(user.delta,
caption = subset(team.data, id == team.id)$name,
col.names = capwords(names(user.delta))))
plot(accumulated)
Expand Down

0 comments on commit 2d57013

Please sign in to comment.