title: Coloring Spatial polygons by Different Levels in R
body: <p>My main goal is to combine several spatial polygons into a map and then color them depend on the level of a variable.</p>
  
  <p>To do that I first clean and aggregate the GADM data: </p>
  
  <pre><code>france &lt;- getData("GADM", country = "FRA", level = 5)    
  </code></pre>
  
  <p>Next, I merge few region as:</p>
  
  <pre><code>Normandie_names &lt;- c("Basse-Normandie", "Haute-Normandie")
  Normandie_index &lt;- which(france$NAME_1 %in% Normandie_names) 
  regionOfInterest_Normandie &lt;- gUnionCascaded(france[Normandie_index, ])
  Normandie        &lt;- regionOfInterest_Normandie %&gt;% geometry
  Normandie        &lt;- sapply(Normandie@polygons, slot, "area") %&gt;% 
  {which(. == max(.))} %&gt;% Normandie[.]
  Normandie$Name &lt;- "Normandie"
  </code></pre>
  
  <p>2) second region in the same fashion:</p>
  
  <pre><code>Bourgogne_Franche_Comte_names &lt;- c("Bourgogne", "Franche-Comté")
  Bourgogne_Franche_Comte_index &lt;- which(france$NAME_1 %in%     
  Bourgogne_Franche_Comte_names)
  regionOfInterest_Bourgogne_Franche_Comte &lt;-   
  
  gUnionCascaded(france[Bourgogne_Franche_Comte_index, ])
  Bourgogne_Franche_Comte&lt;-regionOfInterest_Bourgogne_Franche_Comte%&gt;% geometry
  Bourgogne_Franche_Comte&lt;- sapply(Bourgogne_Franche_Comte@polygons, slot,   "area") %&gt;% 
  {which(. == max(.))} %&gt;% Bourgogne_Franche_Comte[.]
  Bourgogne_Franche_Comte$Name &lt;- "Bourgogne_Franche_Comte"
  </code></pre>
  
  <p>Now, I have 2 spatial polygons but I want to color them based on external values:
  let's say that Bourgogne_Franche_Comte value is 100 and Normandie value is 30.
  I want to color the map in the same color but with different level (i.e. dark or bright green).</p>
  
  <p>First I thought to merge the two spatial polygons:     </p>
  
  <pre><code>joined &lt;- union(Normandie, Bourgogne_Franche_Comte)
  </code></pre>
  
  <p>then maybe use the plot function but  </p>
  
  <pre><code>plot(joined, col = joined$Value)
  </code></pre>
  
  <p>The point is that in want to control the color and the level of the color - depend on the value.</p>
  
  <p>thx for the help !!</p>