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:
> dput(head(Mean))
c(
Thanks to all. And yes, Ivan, round() did it:
> dput(head(Mean))
c(afactfem = 0.310796641158209, afactblk = 0.188030178893171,
age = 45.3185794338312, nodiscfem = 0.506637018185968, discfem =
0.493362981814032,
notradgrol = 0.702915000493879)
> dput(head(Std.dev))
c(afactfem = 0.462819715443265
On Tue, 22 Nov 2022 08:15:57 +0800
"Steven T. Yen" 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.096) w
???
> vals <- signif(cbind(c(.123,.0123), c(1.23,.00123)), digits = 2)
> print(vals)
[,1] [,2]
[1,] 0.120 1.2000
[2,] 0.012 0.0012
2 *significant* digits, but enough digits to right of decimal point to
**allow** the two significant digits to appear and have all numbers in
a column line up
Andrew's example works for him and for me.
If you want help, provide the output of
dput(head(Mean))
dput(head(Std.dev))
On November 21, 2022 4:15:57 PM PST, "Steven T. Yen" wrote:
>Thanks to all, but no, signif() did not work:
>
>> print(signif(cbind(Mean,Std.dev),digits=2))
> Mean Std.
Thanks to all, but no, signif() did not work:
> print(signif(cbind(Mean,Std.dev),digits=2))
Mean Std.dev
[1,] 0.310 0.46
[2,] 0.190 0.39
[3,] 45.000 16.00
[4,] 0.510 0.50
[5,] 0.490 0.50
[6,] 0.700 0.46
On 11/22/2022 5:41 AM, Andrew Simmons wrote:
For print()
,] 45.32 16.31
Regards
Duncan Mackay
-- Original Message --
From: "Jim Lemon"
To: "Steven T. Yen"
Cc: "R-help Mailing List"
Sent: Tuesday, 22 Nov, 2022 At 8:09 AM
Subject: Re: [R] Format printing with R
Hi Steven,
I thought that the problem might be in the
For print(), digits is the minimal number of significant digits. In
your case, rounding the first column to the 3rd decimal place gives at
least 2 sigfigs and rounding the second column to the 2nd decimal
place.
If you want to print all numbers to two significant digits, regardless
of what other n
For better reproducibility, use dput to share data. A matrix and a data frame
look similar, but they can act differently.
On November 21, 2022 1:09:55 PM PST, Jim Lemon wrote:
>Hi Steven,
>I thought that the problem might be in the two large numbers, but
>using a subset (I didn't want to edit ou
Hi Steven,
I thought that the problem might be in the two large numbers, but
using a subset (I didn't want to edit out all the line numbers), I get
what I expected:
sydf<-read.table(text="Mean Std.dev
[1,] 0.3107966 0.462820
[2,] 0.1880302 0.390736
[3,] 45.3185794 16.313635
[4,] 0.50663
Hi, I have two variables with 86 observations each. Below I print with
the print command with digit=2. But, I am getting three decimal places
for my first variable and two for the second. Please help. Thanks.
> cbind(Mean,Std.dev)
Mean Std.dev
[1,] 0.3107966 0.462820
[2,] 0.1
11 matches
Mail list logo