[R] Help with printing fixed width

jim holtman
Fri, 09 Oct 2009 16:03:16 -0000

try using 'sprintf'

On Fri, Oct 9, 2009 at 8:36 AM, sahil seth <sahiilseth at gmail.com>
wrote:
> Hello R users,
> I am writing a summary() for a custom class, and am to display the integers
> right justified,
> Say where x is the vector with integers, I am using the following:
> cat("\t",format(x),"\t"...other columns)
>
> this way I am trying to pass the format(x), to the cat function to display
> it,
> but still I am getting a kink(b/w the 9th and 10th row).
> ? 6 ? ? ?81 ? ? ?170 ? ? ?251 ? ? ?1.998026e-08
> ? 7 ? ? ?26 ? ? ?93 ? ? ?119 ? ? ?4.937587e-10
> ? 8 ? ? ?96 ? ? ?209 ? ? ?305 ? ? ?8.750939e-11
> ? 9 ? ? ?94 ? ? ?211 ? ? ?305 ? ? ?1.758285e-11
> ? ? 10 ? ? ?88 ? ? ?205 ? ? ?293 ? ? ?6.47853e-12
> ? ? 11 ? ? ?82 ? ? ?244 ? ? ?326 ? ? ?7.943691e-20
> ? ? 12 ? ? ?57 ? ? ?145 ? ? ?202 ? ? ?4.964509e-10
> Thanks,
> --
> Regards,
> Sahil Seth
> JHSPH
>
> ? ? ? ?[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



--
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?