I have tried to create an Rshiny-App that showcases sensible data from candidates to the customer. The app itself works fine, but I definitely need to include a password-protection to fullfill data protection guidelines. Could you please help me?
I have tried the following resources already:
https://www.r-bloggers.com/password-protect-shiny-apps/ -> I have no clue what AWS is and how to install it
Starting Shiny app after password input -> this one seems most relevant to me, but as soon as I try to implement it for my purposes, I get the following error when loading the shinymanager package:
> library(shinymanager) Fehler: package or namespace load failed for ‘shinymanager’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]): Namensraum ‘rlang’ 0.4.1 ist bereits geladen, aber >= 0.4.2 wird gefordert
What does that mean?- https://gist.github.com/trestletech/9793754 -> same namespace error + I wonder if I can use this one with my free account even it is says that it refers to Rshiny Pro?
This is very frustrating and our customer is already waiting...
Here is the code I used to create the app:
server.R:
library(shiny)
library(data.table)
library(DT)
library(ggpubr)
library(ggrepel)
library(ggplot2)
# create random data
Total <- rnorm(10, 30, 5)
Yrs <- rnorm(10, 10, 7)
Level <-c("Senior Project Manager", "PM (Border Senior PM)",
"Project Manager", "Senior Project Manager","PM (Border Senior PM)",
"PM (Border Senior PM)","Project Manager","Project Manager",
"Project Manager","Senior Project Manager")
Modality <- c("Small Molecules", "Biologics",
"Both","Both","Both","Biologics","Small Molecules","Small Molecules",
"Biologics","Biologics")
ID <- 1:10
pm <- data.frame(ID,Modality,Level,Yrs,Total)
server <- function(input, output) {
# # choose columns to display
output$mytable1 <- DT::renderDataTable({
# delete ID column
pm$ID <-NULL
DT::datatable(pm[, input$show_vars, drop = FALSE])
if (input$Level != 'Not Relevant') {
pm <-pm[ which(pm$Level==as.character(input$Level)),]
}
else {
pm <- pm}
if (input$Modality != 'Not Relevant') {
pm <-pm[ which(pm$Modality==as.character(input$Modality)),]
}
else
{
pm
}
})
#create scatterplot
output$scatter <- renderPlot({
pm$Level <- factor(pm$Level, levels = c("Senior Project Manager", "PM (Border Senior PM)",
"Project Manager"))
pm$Modality <- factor(pm$Modality, levels = c("Small Molecules", "Biologics",
"Both"))
temp <-ggplot(data=pm, aes(x=Total, y=Yrs, label = ID)) +
geom_point(size = 13,aes(color = Level, shape = Modality),
alpha = 0.5)+
theme(axis.text.y=element_blank())+
scale_y_continuous(expand = c(0,0),limits=c(1,20))+
scale_x_continuous(expand = c(0,0),limits=c(20,36), breaks = c(20,25,30,35))+
ylab("Years of Experience")+
xlab("Total Competency Score")+
scale_color_manual(values = c("#00CCCC", "#CC0099", "#3366FF"))+
scale_shape_manual(values = c(17,19, 15)) +
theme(legend.text = element_text(size = 13),
legend.title = element_text(size = 12))+
ggtitle("Project Manager Ranking", subtitle = "Competency by Years of Experience")+
theme_classic(base_size = 12)
temp+ geom_label_repel(size = 3.5,point.padding = NA)
})
}
ui.R:
ui <- fluidPage(
# title = "Looking for the right candidate for your business?",
titlePanel("Wave 1 - Talent Pipelining"),
setBackgroundColor(
color = c("lightseagreen", "ghostwhite"),
gradient = "linear",
direction = "top"),
sidebarLayout(
sidebarPanel(
### if one of the competencies are selected, they can be sorted by descending order on the table itself
#img(src = "logo.jpg", height = 292, width = 560),
conditionalPanel(
'input.dataset === "Talent Ranking"',
# checkboxGroupInput("show_vars", "Columns in dataset to show:",
# names(pm), selected = names(pm)),
selectInput("Level", "Choose Level of Expertise:",
choices = c("Not Relevant",
"Senior Project Manager" ,"PM (Border Senior PM)", "Project Manager")),
selectInput("Modality", "Choose Modality:",
choices = c("Not Relevant","Both","Biologics", "Small Molecules"))
),
### create a new tab to show venn diagramm and scatterplot
conditionalPanel(
'input.dataset === "Level vs Competency"',
helpText("This scatterplot shows each candidates overall competency score (X-axis) and their respective years of experience (Y-axis)
within their respective fields. Shapes reflect modalities and colours show level of expertise.")
)
),
# Show a summary of the dataset and an HTML table with the requested
# number of observations
mainPanel(
tabsetPanel(
id = 'dataset',
tabPanel("Talent Ranking", DT::dataTableOutput("mytable1")),
tabPanel("Level vs Competency", plotOutput("scatter"))
)
)
)
)