When I call a file inside the tabPanel, it comes with the TRUE value and I can't remove it, I've tried several ways with several examples, but without success. I'm working directly on the file that calls another file.
library(shiny)
library(shinythemes)
ui <- fluidPage(
theme = shinytheme("flatly"),
navbarPage(
"Admission System",
tabPanel(
"Recruitment and selection",
source("C:/ProjectsR/openVacancyTest.R")
),
)
)
shinyApp(ui, server)
Below is the code that is called in tabPanel.
library(shiny)
# Define the UI
ui <- fluidPage(
titlePanel("Recruitment and selection"),
sidebarLayout(
sidebarPanel(
tags$head(
tags$link(rel = "stylesheet", href = "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css")
),
tags$style(
HTML("
.green-button {
background-color: #00FF00;
color: #FFFFFF;
}
")
),
actionButton("register_vacancy", label = HTML('<i class="fas fa-check"></i> Open Vacancy'),style = "background-color: blue; color: #FFFFFF;"),
br(),
conditionalPanel(
condition = "input.register_vacancy > 0",
textInput("title", "Title:"),
selectInput("client", "Client:",
choices = c(" ", "Jacob Thompson",
"Emma Wilson",
"Alexander Hughes",
"Isabella Brooks",
"William Parker",
"Sophia Turner",
"Benjamin Mitchell" )),
textInput("contact", "Contact:"),
textAreaInput("des", "Job description:", value = "Job description"),
textInput("form", "Form of work:"),
selectInput("tip", "Hiring type:",
choices = c ("CLT",
"CLT-Temporary",
"Internship",
"Legal Person")),
textInput("cat", "Category:"),
numericInput("rem", "Remuneration:", value = 0),
textInput("com", "Comments:"),
selectInput("experience_level", "Experience Level:",
choices = c("Beginner", "Intermediry", "Advanced")),
br(),
textOutput("message"),
actionButton("copy_data", "Send request")
)
),
mainPanel(
conditionalPanel(
condition = "input.copy_data > 0",
h3("Vacancy data"),
tableOutput("copied_data")
)
)
)
)
server <- function(input, output, session) {
copied_data <- reactiveValues(data = data.frame())
observeEvent(input$copied_data, {
title <- input$title
client <- input$client
contact <- input$contact
des <- input$des
form <- input$form
tip <- input$tip
cat <- input$cat
rem <- input$rem
com <- input$com
experience_level <- input$experience_level
new_data <- data.frame(Title = title,
Client = client,
Contact = contact,
Des = des,
Form = form,
Tip = tip,
Cat = cat,
Rem = Rem,
Com = com,
Experience_level = experience_level)
copied_data$data <- rbind(copied_data$data, new_data)
updateTextInput(session, "title", value = "")
updateSelectInput(session, "client", selected = "")
updateTextInput(session, "contact", value = "")
updateTextInput(session, "des", value = "")
updateTextInput(session, "form", value = "")
updateSelectInput(session, "tip", selected = "")
updateTextInput(session, "cat", value = "")
updateNumericInput(session, "rem", value = NULL)
updateTextInput(session, "com", value = "")
updateSelectInput(session, "experience_level", selected = "")
output$copied_data <- renderTable({
copied_data$data
})
})
observeEvent(input$copied_data, {
source("C:/ProjectsR/Email.R",local = TRUE)
})
}
shinyApp(ui, server)
Print of error result. Error True
All attempts below did not correct the error, it stayed the same. First try
tabPanel("My Dashboard",
invisible({
source("file.R")
})
)
Second try
tabPanel("My Dashboard",
{
result <- source("file.R", local = TRUE)
}
)
Third try
tabPanel("My Dashboard",
{
eval(parse(file = "file.R"))
}
)
Fourth try
tabPanel("My Dashboard",
{
resultado <- source("file.R", local = TRUE)
}
)