thanks but knitting parameters separately didn't help so far.
output: html_document
params:
text: 'NULL'
data_BU: 'NULL'
data_BU_month: 'NULL'
organizations: 'NULL'
timelimit: 'NULL'
en_time: 'NULL'
projdata: 'NULL'
userinfo: 'NULL'
{r define_title, echo=FALSE, include=FALSE}
Define title from selected organizations
organizations_length <- length(params$organizations)
if (organizations_length >= 5){
titletext <- paste0("Report for ",organizations_length, " selected organizations")
} else(
titletext <- paste0("Report for organizations ", params$organizations)
)
r titletext
Selected timeframe: r params$timelimit
Data last updated at: r params$en_time
{r, include=FALSE}
library(kableExtra)
library(dplyr)
library(ggplot2)
library(lubridate)
library(tidyr)
path <- ifelse(getwd() == "/home/rstudio/reppudashdev",
yes = "/home/rstudio/reppudashdev",
no = "/srv/shiny-server/reppudashboard")
source(paste0(path,"/functions/reppuFunctions.R"), local = TRUE)
{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
Part of the code where userinfo and projdata are used to produce plots
{r plotbox2, echo=FALSE, out.width = "100%", fig.align = "center", fig.asp=0.3}
projectsum_BU <- params$data_BU %>%
filter(Total > 0) %>%
distinct(cscprjnum) %>%
count()
startyear <- parse_date_time(params$timelimit[1],"ym") %>% year()
endyear <- parse_date_time(params$timelimit[2],"ym") %>% year()
userdata <- userinfo()
usersum <- userdata %>%
filter(logindisabled != TRUE | is.na(logindisabled)) %>%
filter(year >= startyear & year <= endyear) %>%
distinct(id_user) %>%
count()
startInterval <- as.Date(parse_date_time(params$timelimit[1],"ym"))
stopInterval <- as.Date(parse_date_time(params$timelimit[2],"ym"))
times <- interval(startInterval, stopInterval + months(1) - days(1) )
projectdata <- projdata()
opened_projects <- projectdata %>%
filter(!is.na(cscprjopendate) & cscprjopendate %within% times & cscprjscope != "personal") %>%
select(cscprjnum) %>%
distinct(cscprjnum) %>%
count()
df <- data.frame(
x = rep(seq(2, 21.5, 6.5), 4) %>% head(3),
y = c(rep(11, 4), rep(6.5, 4), rep(2,4)) %>% head(3),
h = rep(4.25, 3),
w = rep(6.25, 3),
value = c(projectsum_BU$n, opened_projects$n, usersum$n),
info = c("Projects using BUs","New projects opened \n (excl. personal projects)","Users able to log in"),
color = factor(1:3))
ggplot(df, aes(x, y, height = h, width = w, label = info)) +
geom_tile(aes(fill = color)) +
geom_text(color = "#64676b", fontface = "bold", size = 6,
aes(label = value, x = x - 2.9, y = y + 1), hjust = 0) +
geom_text(color = "#64676b", size = 4,
aes(label = info, x = x - 2.9, y = y - 1), hjust = 0) +
coord_fixed() +
scale_fill_manual(values = dashboard_palette(df$info))+
theme_void() +
guides(fill = "none")