title: Creating a loop through multiple datasets
body: <p>For the sibling data I am trying to create a loop that will run sib1 through sib10.  I want to loop forward over each column &amp; if the value is 174 I want to sum the columns and set it equal to 1. This way would be best to run my logistic regression code. My problem is that each sib1-sib10 are datasets not individual columns.  I gave an example of sib1.<br>
  I hope this makes sense, I have been struggling with how to set up this type of loop.</p>
  
  <p>Code:</p>
  
  <pre><code>   sibling=data.table(cbind((data[,'b16aa']),(data[,'b16ba']),(data[,'b16ca']),(data[,'b16da']),(data[,'b16ea']),(data[,'b16fa']),(data[,'b16ga']),(data[,'b16ha']),(data[,'b16ia']),(data[,'b16ja'])))  
     sib1=sibling[sibling$V1==174,]
     sib2=sibling[sibling$V2==174,]
     sib3=sibling[sibling$V3==174,]
     sib4=sibling[sibling$V4==174,]
     sib5=sibling[sibling$V5==174,]                          
     sib6=sibling[sibling$V6==174,]                        
     sib7=sibling[sibling$V7==174,]
     sib8=sibling[sibling$V8==174,]
     sib9=sibling[sibling$V9==174,]
     sib10=sibling[sibling$V10==174,]
  </code></pre>
  
  <p>sib1:</p>
  
  <pre><code>       V1  V2  V3  V4  V5  V6 V7  V8 V9 V10
      1: 174 174  NA  NA  NA  NA NA  NA NA  NA
      2: 174  NA  NA  NA  NA  NA NA  NA NA  NA
      3: 174  NA  NA  NA  NA  NA NA  NA NA  NA
      4: 174  NA  NA  NA  NA  NA NA  NA NA  NA
      5: 174  NA  NA  NA  NA  NA NA  NA NA  NA
      6: 174  NA  NA  NA  NA  NA NA  NA NA  NA
      7: 174  NA  NA 174  NA 174 NA 174 NA  NA
      8: 174  NA  NA  NA  NA  NA NA  NA NA  NA
      9: 174  NA  NA  NA  NA  NA NA  NA NA  NA
     10: 174  NA  NA  NA  NA  NA NA  NA NA  NA
  </code></pre>