I have two files app.R and LoanHealthv2.R
app.R has following code. I am taking noc as input name which I need to pass as input to LoanHealthv2.R file and compute the results so that I can use the results of LoanHealthv2.R file in this app.
Also how can I make it reactive so that everytime I select different noc it generates new results?
########################## Ui function ################################
ui=fluidPage(
titlePanel("Loan Health"),
fluidRow(
selectInput("noc","Name of Customer", customers[,1], selected = NULL, multiple = FALSE,
selectize = TRUE, width = NULL, size = NULL)
),
mainPanel(
plotOutput("Plot", width = "100%", height = "400px", click = NULL,
dblclick = NULL, hover = NULL, hoverDelay = NULL,
hoverDelayType = NULL, brush = NULL, clickId = NULL,
hoverId = NULL, inline = FALSE)
)
)
########################## server function ################################
server <- function(input, output) {
output$Plot<-renderPlot({
customer<-input$noc #Name of customer
plot(SalesClientData$Date,SalesClientData$DPD,type="l")
})
}
shinyApp(ui, server)
LoanHealthv2.R looks like this
customer = "A1" #<-I want this to be equal to input `noc` from app.R and compute the result below and make it available so that I can plot output.
account<-customers[which(customers[,1]==customer), 2]
start<- customers[which(customers[,1]==customer), 3]
SalesClientData = subset(POSData,POSData$Loan_Account_Number==account)