Example code to reproduce the bug report:

> DataFrame(a = 'foo', b = NA_character_)
DataFrame with 1 row and 2 columns
Error in if (nchar(x) > n) paste0(paste(strsplit(x, "")[[1]][1:n], collapse = 
""),  (from reduce.R#6) : 
  missing value where TRUE/FALSE needed

Suggested patch:

setMethod("showAsCell", "character",
          function (object) {
              n <- 10
              sapply(object, function(x) {
                  if (!is.na(x) & nchar(x) & nchar(x) > n) 
                      paste0(paste(strsplit(x, "")[[1]][1:n], collapse = ""), 
                             "...")
                  else x
              })
          })


With patch:

> DataFrame(a = 'foo', b = NA_character_)
DataFrame with 1 row and 2 columns
               a           b
     <character> <character>
foo        foo          NA


Best wishes,

Laurent

_______________________________________________
Bioc-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel

Reply via email to