Are you trying to put `if` statements into a `magritrr` piping chain? A little experiment will show this does not work:

    > z = 1
    > 2 %>% sqrt() %>% if(z==1){log()} %>% if(z==2){sqrt()} %>% sqrt
    [1] TRUE

You can't put logic like that in `magrittr` pipe chains, so take it outside.

In your case, put something like this outside the `leaflet` pipe:

      if(input$map == "1"){
         mapdata = data1
         mapcol = rgb(215,48,39, max = 255)
      }
      if(input$map == "2"){
         mapdata = data2
         mapcol = rgb(....blah)
      }
      etc etc

Then in your pipe its:

        leaflet... %>% 
        addCircleMarkers(data = mapdata, 
                       lat =  mapdata$Lat, 
                       lng =  mapdata$Lon, 
                       radius = 4, col = mapcol) %>%

Some further investigation shows you *can* put `if` in a pipe if you wrap it in cotton-wool:
      
    > 2 %>% (if(z==1){log}else{sqrt})
    [1] 0.6931472

but just because you can doesn't mean you should. Keep logic out of pipes.

Another way of doing this is to build the piped object gradually. Something like:

     # start
     m = leaflet()
     # conditional bits
     if(a==1){
        m = m %>% foo()
     }
     if(a==2){
        m = m %>% bar()
     }
     # bits at the end
     m = m %>% baz()
     
     m # is now my pipe result