[Seqinr-commits] r1615 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jun 24 11:04:47 CEST 2009


Author: lobry
Date: 2009-06-24 11:04:46 +0200 (Wed, 24 Jun 2009)
New Revision: 1615

Modified:
   pkg/R/readBins.R
Log:
fixing a bug with trailling tabulations

Modified: pkg/R/readBins.R
===================================================================
--- pkg/R/readBins.R	2009-06-24 09:03:58 UTC (rev 1614)
+++ pkg/R/readBins.R	2009-06-24 09:04:46 UTC (rev 1615)
@@ -17,11 +17,18 @@
   	  locstops <- c(iMark[-1] - 1, length(locsrc))
   	  for(j in seq_len(length(iMark))){
   	  	  mycon <- textConnection(locsrc[locstarts[j]:locstops[j]])
-  	  	  locres[[j]] <- read.table(mycon, sep = "\t", fill = TRUE)
+  	  	  locres[[j]] <- read.table(mycon, sep = "", fill = TRUE) # changed
   	  	  colnames(locres[[j]])[1:length(colnames)] <- colnames
   	  	  close(mycon)
   	  	  names(locres)[j] <- unlist(strsplit(locsrc[iMark[j]], split = "\t"))[2]
   	  	}
+  	  	#
+  	  	# Check that the number of columns is 4 for all loci:
+  	  	#
+  	  	ncols <- sapply(locres, ncol)
+  	  	if(any((ncols != 4))){
+  	  		warning("A problem may have occur during importation")
+  	  	}
     result[[i+1]] <- locres
     names(result)[i+1] <- unlist(strsplit(src[iPanel[i]], split = "\t"))[2]
   }



More information about the Seqinr-commits mailing list