samedi 28 août 2021

Calculate total score and categorize it based on input

I'm trying to create an application for the SLE disease scoring system, in which each symptom is represented by a different number, 

The total of symptom scores will be divided into a range of scores to determine disease activity.

Here is the code that I'm trying to write, but I haven't been able to figure out what the problem is that is keeping this program from running.



ui <- fluidPage(
    checkboxGroupInput("variable", "Variables to show:",
                       c("Neurological disorder" = "neu",
                         "Kidney disorder" = "gin",
                         "Vasculitis" = "vas",
                         "Haemolysis/ Thrombositopenia" = "hem",
                         "Myositis" = "mio",
                         "Artritis" = "art",
                         "Mucocutaneous disorder" = "muc",
                         "Serositis" = "ser",
                         "Fever/ Fatique" = "fev",
                         "Leukopenia/ Lhymphopenia" = "leu"
                         )),
    textOutput("data")
)

server <- function(input, output, session) {

       
    output$data <- reactive({
        input$neu == 8
        input$gin == 6
        input$vas == 4
        input$hem == 3
        input$mio == 3
        input$art == 2
        input$mio == 2
        input$ser == 2
        input$fev == 1
        input$leu == 1
        
    
        total <- input$neu + input$gin + input$vas + input$hem + input$mio +  
            input$art + input$mio + input$ser + input$fev + input$fev + input$leu
        
        if (total <= 2) {"Mild disease activity"}
        else if (total > 2 && < 5) {"Moderate disease activity"}
        else if (total > 5) {"Severe disease activity"}
})

shinyApp(ui, server)


Thank you for your help

Aucun commentaire:

Enregistrer un commentaire