I have three excel databases that I'm pulling into my code (I cannot share any data due to the privacy rules of my organization- I understand that this is an issue).
My app runs perfectly fine and shows me what I want to see. The only issue I have is when I publish- it is connected to my account, and my logs seem to show no errors:
2022-03-26T21:11:16.277144+00:00 shinyapps[5919831]:
2022-03-26T21:11:16.277096+00:00 shinyapps[5919831]: The following objects are masked from ‘package:stats’:
2022-03-26T21:11:16.277234+00:00 shinyapps[5919831]:
2022-03-26T21:11:16.277194+00:00 shinyapps[5919831]: filter, lag
2022-03-26T21:11:16.277325+00:00 shinyapps[5919831]:
2022-03-26T21:11:16.277579+00:00 shinyapps[5919831]:
2022-03-26T21:11:16.277416+00:00 shinyapps[5919831]:
2022-03-26T21:11:16.277281+00:00 shinyapps[5919831]: The following objects are masked from ‘package:base’:
2022-03-26T21:11:16.277512+00:00 shinyapps[5919831]: Attaching package: ‘lubridate’
2022-03-26T21:11:16.276989+00:00 shinyapps[5919831]: Attaching package: ‘dplyr’
2022-03-26T21:11:16.277774+00:00 shinyapps[5919831]:
2022-03-26T21:11:16.277462+00:00 shinyapps[5919831]:
2022-03-26T21:11:16.277731+00:00 shinyapps[5919831]: date, intersect, setdiff, union
2022-03-26T21:11:16.277627+00:00 shinyapps[5919831]: The following objects are masked from ‘package:base’:
2022-03-26T21:11:16.277681+00:00 shinyapps[5919831]:
2022-03-26T21:11:16.277369+00:00 shinyapps[5919831]: intersect, setdiff, setequal, union
2022-03-26T21:11:21.275866+00:00 shinyapps[5919831]: Running on host: f5c42320a7fe
2022-03-26T21:11:21.275927+00:00 shinyapps[5919831]: Server version: 2022.02.0
2022-03-26T21:11:21.275977+00:00 shinyapps[5919831]: LANG: C.UTF-8
2022-03-26T21:11:21.276031+00:00 shinyapps[5919831]: R version: 4.1.3
2022-03-26T21:11:21.276074+00:00 shinyapps[5919831]: shiny version: 1.7.1
2022-03-26T21:11:21.276314+00:00 shinyapps[5919831]: RJSONIO version: (none)
2022-03-26T21:11:21.276411+00:00 shinyapps[5919831]: reticulate version: (none)
2022-03-26T21:11:21.276455+00:00 shinyapps[5919831]: Using pandoc: /opt/connect/ext/pandoc/2.16
2022-03-26T21:11:21.276498+00:00 shinyapps[5919831]: Using jsonlite for JSON processing
2022-03-26T21:11:21.276544+00:00 shinyapps[5919831]:
2022-03-26T21:11:21.276124+00:00 shinyapps[5919831]: httpuv version: 1.6.5
2022-03-26T21:11:21.276590+00:00 shinyapps[5919831]: Starting R with process ID: '44'
2022-03-26T21:11:21.276173+00:00 shinyapps[5919831]: rmarkdown version: (none)
2022-03-26T21:11:21.276217+00:00 shinyapps[5919831]: knitr version: (none)
2022-03-26T21:11:21.276267+00:00 shinyapps[5919831]: jsonlite version: 1.8.0
2022-03-26T21:11:21.276364+00:00 shinyapps[5919831]: htmltools version: 0.5.2
2022-03-26T21:11:21.276661+00:00 shinyapps[5919831]: Shiny application starting ...
2022-03-26T21:11:22.275996+00:00 shinyapps[5919831]: Attaching package: ‘dplyr’
2022-03-26T21:11:22.275909+00:00 shinyapps[5919831]:
2022-03-26T21:11:22.276061+00:00 shinyapps[5919831]:
2022-03-26T21:11:22.276206+00:00 shinyapps[5919831]: filter, lag
2022-03-26T21:11:22.276114+00:00 shinyapps[5919831]: The following objects are masked from ‘package:stats’:
2022-03-26T21:11:22.276248+00:00 shinyapps[5919831]:
2022-03-26T21:11:22.276157+00:00 shinyapps[5919831]:
2022-03-26T21:11:22.276299+00:00 shinyapps[5919831]: The following objects are masked from ‘package:base’:
2022-03-26T21:11:22.276350+00:00 shinyapps[5919831]:
2022-03-26T21:11:22.276401+00:00 shinyapps[5919831]: intersect, setdiff, setequal, union
2022-03-26T21:11:22.276453+00:00 shinyapps[5919831]:
2022-03-26T21:11:22.276498+00:00 shinyapps[5919831]:
2022-03-26T21:11:22.276546+00:00 shinyapps[5919831]: Attaching package: ‘lubridate’
2022-03-26T21:11:22.276645+00:00 shinyapps[5919831]: The following objects are masked from ‘package:base’:
2022-03-26T21:11:22.276595+00:00 shinyapps[5919831]:
2022-03-26T21:11:22.276692+00:00 shinyapps[5919831]:
2022-03-26T21:11:22.276764+00:00 shinyapps[5919831]: date, intersect, setdiff, union
2022-03-26T21:11:22.276809+00:00 shinyapps[5919831]:
I have updated all my packages, I do not have a line of code setting the working directory, my file paths are relative, and I have library calls for all the packages I use.
library(dplyr)
library(lubridate)
library(shiny)
# Load data
library(readxl)
#data1
data1 <- readxl::read_xlsx("data/data1\ database\ copy.xlsx") %>%
select(`Player Name`, `Total Duration`, Date, `Total Distance`, `Total Player Load`, `Maximum Velocity`, HSD, `Zone 5 Distance` = `Velocity Band 5 Total Distance`, `Zone 6 Distance`, Sprints, `Period Name`, `Position Name`, `Activity Name`, Accelerations = `IMA Accel High`, Decelerations = `IMA Decel High`)
#fix columns, round
data1$Date <- as.Date(data1$Date)
data1$`Total Duration` <- format(data1$`Total Duration`, format = "%H:%M:%S")
#data1$`Total Duration` <- round((data1$`Total Duration` *86400)/60)
data1$`Total Distance` <- round(data1$`Total Distance`, 0)
data1$`Total Player Load` <- round(data1$`Total Player Load`, 0)
data1$`Maximum Velocity` <- round(data1$`Maximum Velocity`, 1)
data1$Sprints <- round(data1$Sprints, 0)
data1$HSD <- round(data1$HSD, 0)
data1$`Zone 5 Distance` <- round(data1$`Zone 5 Distance`, 0)
data1$`Zone 6 Distance` <- round(data1$`Zone 6 Distance`, 0)
#data2
data2 <- readxl::read_xlsx("data/data2\ Database.xlsx") %>%
select(`Player Name` = `Athlete name`, Date = `Start date (dd.mm.yyyy)`, TRIMP = `TRIMP (Index)`, `Analysis period`, `Red Zone (min)` = `High intensity training (hh:mm:ss)`)
#fix columns
data2$TRIMP <- round(data2$TRIMP, 0)
names(data2)[1] <- "Player Name"
data2 <- data2 %>% dplyr::filter(`Analysis period` == "Measurement")
data2$seconds <- as.numeric(format(data2$`Red Zone (min)`, format = "%S", na.encode=F)) + 60*as.numeric(format(data2$`Red Zone (min)`, format = "%M"), na.encode=F)
data2$`Red Zone (min)` <- format(data2$`Red Zone (min)`, format = "%H:%M:%S")
data2$Date <- as.Date(data2$Date)
#data3
data3 <- readxl::read_excel("data/data3\ and\ missing\ data.xlsx")
names(data3)[1] <- "Player Name"
data3$Date <- as.Date(data3$Date)
#MERGE
merged_data <- dplyr::full_join(data1, data2, by = c("Date", "Player Name"))
merged_data <- dplyr::full_join(merged_data, data3, by = c("Date", "Player Name"))
merged_data_today <- merged_data %>% dplyr::filter(Date == lubridate::today())
#create a separate table for the 1st team
first_team <- merged_data_today %>% dplyr::filter(`Activity Name` == "FIRST")
first_team <- first_team %>% dplyr::filter(`Period Name` == "Session")
first_team1 <- first_team %>% dplyr::filter(`Position Name` != "Goal Keeper")
first_team <- first_team1[,c(1:2, 4:10, 14:16, 18, 20)]
seconds.avg <- lubridate::seconds_to_period(round(mean(first_team1$seconds, na.rm=T), 0))
first_average <- data.frame(`Distance` = round(mean(first_team1$`Total Distance`), 0), `Player Load` = round(mean(first_team1$`Total Player Load`), 0), `Maximum Velocity` = round(mean(first_team1$`Maximum Velocity`), 1), `HSD` = round(mean(first_team1$HSD), 0), `Zone 5 Distance` = round(mean(first_team1$`Zone 5 Distance`), 0), `Zone 6 Distance` = round(mean(first_team1$`Zone 6 Distance`), 0), `Sprints` = round(mean(first_team1$Sprints), 0), Accelerations = round(mean(first_team1$Accelerations), 0), Decelerations = round(mean(first_team1$Decelerations), 0), TRIMP = round(mean(first_team1$TRIMP, na.rm=T), 0), `Red Zone (min)` = sprintf('%02d:%02d:%02d', seconds.avg@hour, minute(seconds.avg), second(seconds.avg)), data3 = round(mean(first_team1$data3), 0))
#create a separate table for modified 1st team
modified_team <- merged_data_today %>% dplyr::filter(`Activity Name` == "Modified")
#create a separate table for Rehab guys
rehab_team <- merged_data_today %>% dplyr::filter(`Period Name` == "Session")
rehab_team <- rehab_team %>% dplyr::filter(`Activity Name` == "RTT")
#tables to include all players (no click to next page)
library(DT)
options(DT.options = list(pageLength = 30, autoWidth = TRUE))
# Define UI
ui <- basicPage(
h2("First Team Data"),
shiny::dataTableOutput("first"),
h4("First Team Averages"),
shiny::dataTableOutput("first_average"),
h2("Modified First Team"),
shiny::dataTableOutput("modified"),
h2("Rehab"),
shiny::dataTableOutput("rehab")
)
# Define server function
server <- function(input, output) {
#output the necessary tables
output$`first` = shiny::renderDataTable({
first_team
})
output$`first_average` = shiny::renderDataTable({
first_average
})
output$`modified` = shiny::renderDataTable({
modified_team[,c(1:2, 4:10, 14:16, 18, 20)]
})
output$`rehab` = shiny::renderDataTable({
rehab_team[,c(1:2, 4:10, 14:16, 18, 20)]
})
}
# Create Shiny object
shinyApp(ui = ui, server = server)