title: Comparing 4 column values to make a new column
body: <p>I'd like to hold the non NA values in a row, then pick the first element in 
  the list as the final value for a new column (ncol). </p>
  
  <p>Here's an example of what I'm trying to get and the code I've unable to get
  to run...</p>
  
  <pre><code>ID &lt;- c(1,2,3,4) 
  A &lt;- c("A", "NA", "C", "R")
  B &lt;- c("G", "V", "NA", "T")
  C &lt;- c("NA", "NA", "NA", "Y")
  D &lt;- c("U", "W", "NA", "NA")
  
  
  mydf &lt;- data.frame(ID, A, B, C, D, ncol)
  
  
   ID  A  B  C  D ncol
  1  1  A  G NA  U    A
  2  2 NA  V NA  W    V
  3  3  C NA NA NA    C
  4  4  R  T  Y NA    R
  
  
  mycol &lt;- c(mydf$A, mydf$B, mydf$C, mydf$D)
  for (i in seq(1:nrow(mydf))){
     listcolincldata &lt;- lapply(mycol[i],[!is.na(mycols[i])])
     print(listcolincldata)
     mydf$newcol[i] &lt;- (as.character(listcolincldata[1]))
  }
  </code></pre>