[Seqinr-commits] r1888 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jun 2 12:40:10 CEST 2016


Author: jeanlobry
Date: 2016-06-02 12:40:10 +0200 (Thu, 02 Jun 2016)
New Revision: 1888

Modified:
   pkg/R/getLength.R
Log:
to fix the getLength(ec999) bug repported by Haruo Suzuki

Modified: pkg/R/getLength.R
===================================================================
--- pkg/R/getLength.R	2016-06-02 09:26:12 UTC (rev 1887)
+++ pkg/R/getLength.R	2016-06-02 10:40:10 UTC (rev 1888)
@@ -10,7 +10,16 @@
 getLength.list <- function(object, ...)
   sapply(seq_len(length(object)), function(i) getLength(object[[i]], ...))
 
-getLength.character <- function(object, ...) length(s2c(object))
+getLength.character <- function(object, ...){
+  if(length(object) == 1)
+  {
+    return(length(s2c(object)))
+  } 
+  else 
+  {
+    return(sum(nchar(object)))
+  }
+}
 
 getLength.SeqFastadna <- function(object, ...) length(getSequence(object, as.string = FALSE))
 getLength.SeqFastaAA <- getLength.SeqFastadna



More information about the Seqinr-commits mailing list