title: Mapping the column basis on certain key words and creating a new variable in R
body: <p>I got a Name column in which i want to create a new column such that  if i got names containing 'Nivia' or 'india' (irrespctive of capital or small) it should be mapped as "Internal" and the rest as Others.</p>
  
  <p>Below is the data and the code i tried but with no luck:</p>
  
  <pre><code>structure(list(Name = structure(c(8L, 8L, 8L, 8L, 8L, 8L, 8L, 
  8L, 8L, 8L, 8L, 8L, 8L, 8L, 2L, 2L, 2L, 3L, 7L, 7L, 7L, 7L, 7L, 
  7L, 9L, 9L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 9L, 9L, 7L, 7L, 7L, 
  7L, 7L, 7L, 7L, 7L, 14L, 14L, 14L, 14L, 10L, 11L, 13L, 4L, 15L, 
  5L, 5L, 5L, 12L, 6L, 1L), .Label = c("ASIAKASTIETOOY", "CARGO PARTNER LOGISTICS INDIA PVT LTD", 
  "DKSH INDIA PRIVATE LIMITED", "FONECTAOY", "INTRUM JUSTITIA OY", 
  "LINDSTROMOY", "Nivia Cosmetics Global S.A., Luxembourg, Schaffhausen Branch", 
  "Nivia INDIA PVT. LTD.", "Nivia SOFTWARE S.R.O", "Posti Oy", 
  "Ruoholahden Hoitokeskus", "S-Business Oy", "S1 Networks Oy", 
  "Secto Automotive Oy", "SLP Group Oy / Ukko.fi"), class = "factor")), class = "data.frame", row.names = c(NA, 
  -59L))
  </code></pre>
  
  <p>Below is the code i tried:</p>
  
  <pre><code>name$Name&lt;-as.character(name$Name)
  
  name$newname&lt;-ifelse(name$Name=='Nivia',"Internal","Others")
  name$newname&lt;-ifelse(name$Name=='india',"Internal","Others")
  </code></pre>