R-alpha: patch for formatC(..char.vector..)
Martin Maechler
Martin Maechler <maechler@stat.math.ethz.ch>
Tue, 27 May 97 18:20:44 +0200
Apply this patch in
src/library/base/funs/
--- 049orig/format~ Thu Mar 6 16:59:56 1997
+++ format Tue May 27 18:11:27 1997
@@ -22,8 +22,11 @@
width <- -width
}
pad <- sapply(pmax(0, width - nc), bl.string)
- ## for R <= 0.16 (incompatibility to S):
- if(is.list(pad)) pad <- ""
+ ## for R <= 0.49 (incompatibility to S), pad may be list:
+ if(is.list(pad)) {
+ pad[sapply(pad,length) == 0] <- list("")
+ pad <- unlist(pad)
+ }
if (flag == "-")
return(paste(x, pad, sep = ""))
else return(paste(pad, x, sep = ""))
AFTER applying the patch,
tst.ch <- c("a", "ABC", "XYZ", "dd")
cbind(formatC(tst.ch, wid = 3))
works okay.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-