[R] most stable way to output text layout

Greg Minshall m|n@h@|| @end|ng |rom um|ch@edu
Sat Jun 12 19:04:02 CEST 2021


Jeremie,

i'm not totally sure i understand your desire.  but, does this help?

----
  mx <- max(nchar(mat), na.rm=TRUE)
  apply(
    mat,1,
    function(x) {
      x[is.na(x)] <-""
      cat(sprintf("%*s", mx, x), "\n")
    })
----

cheers, Greg



More information about the R-help mailing list