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