title: looping to concatenate string
body: <p>Sorry for asking a basic question. I've tried looking for the answer in the  following links but with no luck </p>
  
  <p><a href="https://stackoverflow.com/questions/10115832/how-to-concatenate-strings-in-a-loop">How to concatenate strings in a loop?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/10115832/how-to-concatenate-strings-in-a-loop">How to concatenate strings in a loop?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/13169562/c-concatenate-string-with-int-in-loop">C concatenate string with int in loop</a></p>
  
  <p>So, here is a reproducible example. I've a list called house i.e</p>
  
  <p><code>house &lt;- c("Dining Room", "Drawing Room", "Number of Bathrooms", "5", "Number of Bedroom", "5", "Number of Kitchens", "1")</code></p>
  
  <p>where every element in the house list is character. Now I want to create another list where if the element of list is of character length of one(representing a number) then it should concatenate with the previous string element. This is output I am expecting.</p>
  
  <p><code>"Dining Room", "Drawing Room", "Number of Bathrooms 5", "Number of Bedroom 5", "Number of Kitchens 1"</code></p>
  
  <p>I have tried running a loop but the output is not similar to what I expect.</p>
  
  <p><code>
  for(i in house){
    if(!is.na(nchar(house[i])) == 1) {
       cat(i,i-1)
    } else{
      print(i)
    }
  }</code></p>