I have what I feel is quite a low level question, but have struggled to find an answer nonetheless. Currently for each output I have defined variables within, such as 'L0' here :
output$loanamount <- renderText({ L0 <- isolate(input$price) - ((isolate(input$deposit))/100)*isolate(input$price) paste(sep='',"Loan Amount: £",L0) })
However, when creating a new output using some of the same variables, I have to redefine them, like in this case with L0 : output$mortgagepayments <- renderText({ intrate <- ((isolate(input$apr))/(100*12)) L0 <- isolate(input$price) - ((isolate(input$deposit))/100)*isolate(input$price) bottomdiscount <- L0*intrate topdiscount <- 1- 1/(1+intrate)^(12*isolate((input$term))) mortgagepayments <- bottomdiscount/topdiscount paste(sep='',"Monthly Mortgage Payments: £",round(mortgagepayments,2)) })
What I would like to know is if there is a way I can define say 'L0' once somewhere in the server and then call on it within a render, without having to redefine it for each new render. I hope this makes sense. Many thanks in advance!