title: Scripts return a NULL value
body: <p>I have this script:</p>
  
  <pre><code>dat &lt;- read.csv(file="Task_vs_Files_Whirr2.csv", header=T, sep=",",
                  row.names=1) 
  (sapply(1:nrow(dat), function(x) {
      if (dat[x,2]==1) { 
           write.csv(dat[ (dat[[2]]==1 ) &amp; (1:nrow(dat) &gt;= x) , ] , 
                     file = paste("fil_", x, ".csv") )
      } else {
           NULL
   }))
  </code></pre>
  
  <p>but the script return NULL value, as below:</p>
  
  <pre><code>[[1]]
  NULL
  
  [[2]]
  NULL
  
  [[3]]
  NULL
  
  [[4]]
  NULL
  
  [[5]]
  NULL
  
  [[6]]
  NULL
  
  [[7]]
  NULL
  </code></pre>
  
  <p>Here are other details:</p>
  
  <pre><code>&gt; str(dat) 
  'data.frame':   7 obs. of  7 variables:
   $ pom.xml.         : int  1 1 0 0 0 1 1
   $ ZooKeeper.java   : int  0 0 0 0 0 1 0
   $ HBase.java       : int  1 1 1 0 1 1 0
   $ Hadoop.java.     : int  0 0 0 0 0 0 1
   $ BasicServer.java.: int  1 0 0 0 0 0 0
   $ Abstract.java.   : int  1 1 0 1 0 1 1
   $ HBaseRegion.java : int  1 0 0 0 0 1 1
  
  &gt; dput(dat)
  structure(list(pom.xml. = c(1L, 1L, 0L, 0L, 0L, 1L, 1L), ZooKeeper.java = c(0L, 
  0L, 0L, 0L, 0L, 1L, 0L), HBase.java = c(1L, 1L, 1L, 0L, 1L, 1L, 
  0L), Hadoop.java. = c(0L, 0L, 0L, 0L, 0L, 0L, 1L), BasicServer.java. = c(1L, 
  0L, 0L, 0L, 0L, 0L, 0L), Abstract.java. = c(1L, 1L, 0L, 1L, 0L, 
  1L, 1L), HBaseRegion.java = c(1L, 0L, 0L, 0L, 0L, 1L, 1L)), .Names = c("pom.xml.", 
  "ZooKeeper.java", "HBase.java", "Hadoop.java.", "BasicServer.java.", 
  "Abstract.java.", "HBaseRegion.java"), class = "data.frame", row.names = c("WHIRR-25", 
  "WHIRR-28", "WHIRR-55", "WHIRR-61", "WHIRR-76", "WHIRR-87", "WHIRR-92"
  ))
  
  &gt; sessionInfo()
  R version 2.13.1 (2011-07-08)
  Platform: i386-pc-mingw32/i386 (32-bit)
  
  locale:
  [1] LC_COLLATE=English_Australia.1252  LC_CTYPE=English_Australia.1252    LC_MONETARY=English_Australia.1252 LC_NUMERIC=C                      
  [5] LC_TIME=English_Australia.1252    
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     
  </code></pre>