[R] Format printing with R

Robert Baer rb@er @end|ng |rom @t@u@edu
Sun Dec 11 20:27:10 CET 2022

```And you will probably want to read the details of the  ?round help, so
you understand how it handles 5 rounding.  It is a little more
complicated than some of us learned in school.

On 11/22/2022 4:24 AM, Steven T. Yen wrote:
> Thanks to all. And yes, Ivan, round() did it:
>
> c(afactfem = 0.310796641158209, afactblk = 0.188030178893171,
> age = 45.3185794338312, nodiscfem = 0.506637018185968, discfem =
> 0.493362981814032,
> notradgrol = 0.702915000493879)
> c(afactfem = 0.462819715443265, afactblk = 0.390736267472797,
> age = 16.3136348021933, nodiscfem = 0.499955948049025, discfem =
> 0.499955948049025,
> notradgrol = 0.456974290933931)
> > round(cbind(Mean,Std.dev),2)[1:10,]
>             Mean Std.dev
> afactfem    0.31    0.46
> afactblk    0.19    0.39
> age        45.32   16.31
> nodiscfem   0.51    0.50
> discfem     0.49    0.50
> notradgrol  0.70    0.46
> tradgrol    0.30    0.46
> nofemnopol  0.80    0.40
> femnopol    0.20    0.40
> nopreshurt  0.66    0.47
>
> On 11/22/2022 3:08 PM, Ivan Krylov wrote:
>> On Tue, 22 Nov 2022 08:15:57 +0800
>> "Steven T. Yen" <styen using ntu.edu.tw> wrote:
>>
>>> Thanks to all, but no, signif() did not work:
>> It worked, just didn't do what you wanted it to do. I think you want
>> round(), not signif(). Some of your numbers (45.3185794) will be rounded
>> to 4 significant digits and others (0.0969999) will be rounded to 1
>> significant digit, but the number of decimal places will be 2.
>>
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.

```