Here is part of my code after getting a table named full,
full <- full %>% pivot_longer(cols = -num)
    p <- ggplot(full, aes(x=num,y=value,group=name,color=name,linetype=name))+
      geom_line()
    
    if(input$po == c(1,2) | input$po == c(2,1) ){
       p <- p + 
        scale_color_manual(values = c(Policy1='red',Policy1reuse ='red', Policy2='blue',Policy2reuse ='blue'))+
        scale_linetype_manual(values = c(Policy1='solid',Policy1reuse ='dashed', Policy2='solid',Policy2reuse ='dashed'))
      }
    else if(input$po == c(1,3) | input$po == c(3,1) ){
      p <- p + 
        scale_color_manual(values = c(Policy3='green',Policy3reuse ='green', Policy1='blue',Policy1reuse ='blue'))+
        scale_linetype_manual(values = c(Policy3='solid',Policy3reuse ='dashed', Policy1='solid',Policy1reuse ='dashed'))}
I am doing a render plot here and input$po is the number user enter in a selectInput,
suppose I enter 1,2 or 2,1 or 3,1, it works fine, for example if I enter 3,1:
Here is the table:

and here are the input and plot:
 
 But if I enter 1,3 it will come out an error:
But if I enter 1,3 it will come out an error:
 

I don't understand why this is happening and if I remove the scalar_color_manual and scalar_linetype_manualof the 1,2 and 2,1 condition part, the 1,3 will work out! but not in the linetype and color I want. And if I put 1,3 and 3,1 in if, and 1,2 2,1 in else if, then 1,3 will work out fine but 1,2 will run with this error, how can I fix this. Thank you for any help.
