Displaying 20 results from an estimated 600 matches similar to: "trying to mimic page 70 of Software for Data Analysis"
2023 Dec 16
1
zapsmall(x) for scalar x
I was quite suprised to discover that applying `zapsmall` to a scalar value has no apparent effect. For example:
> y <- 2.220446e-16
> zapsmall(y,)
[1] 2.2204e-16
I was expecting zapsmall(x)` to act like
> round(y, digits=getOption('digits'))
[1] 0
Looking at the current source code, indicates that `zapsmall` is expecting a vector:
zapsmall <-
function (x, digits =
2023 Dec 17
1
zapsmall(x) for scalar x
Zapping a vector of small numbers to zero would cause problems when
printing the results of summary(). For example, if
zapsmall(c(2.220446e-16, ..., 2.220446e-16)) == c(0, ..., 0) then
print(summary(2.220446e-16), digits = 7) would print
Min. 1st Qu. Median Mean 3rd Qu. Max.
0 0 0 0 0 0
The same problem can also appear when
2023 Dec 17
1
zapsmall(x) for scalar x
Isn?t that the correct outcome? The user can change the number of digits if they want to see small values?
--
Change your thoughts and you change the world.
--Dr. Norman Vincent Peale
> On Dec 17, 2023, at 12:11?AM, Steve Martin <stevemartin041 at gmail.com> wrote:
>
> ?Zapping a vector of small numbers to zero would cause problems when
> printing the results of summary().
2023 Dec 17
2
[External] Re: zapsmall(x) for scalar x
I think what's been missed is that zapsmall works relative to the absolute
largest value in the vector. Hence if there's only one
item in the vector, it is the largest, so its not zapped. The function's
raison d'etre isn't to replace absolutely small values,
but small values relative to the largest. Hence a vector of similar tiny
values doesn't get zapped.
Maybe the line
2023 Dec 18
1
[External] Re: zapsmall(x) for scalar x
Le 17/12/2023 ? 18:26, Barry Rowlingson a ?crit?:
> I think what's been missed is that zapsmall works relative to the absolute
> largest value in the vector. Hence if there's only one
> item in the vector, it is the largest, so its not zapped. The function's
> raison d'etre isn't to replace absolutely small values,
> but small values relative to the largest.
2023 Dec 18
1
[External] Re: zapsmall(x) for scalar x
>>>>> Serguei Sokol via R-devel
>>>>> on Mon, 18 Dec 2023 10:29:02 +0100 writes:
> Le 17/12/2023 ? 18:26, Barry Rowlingson a ?crit?:
>> I think what's been missed is that zapsmall works relative to the absolute
>> largest value in the vector. Hence if there's only one
>> item in the vector, it is the largest, so its
2023 Dec 18
1
[External] Re: zapsmall(x) for scalar x
Le 18/12/2023 ? 11:24, Martin Maechler a ?crit?:
>>>>>> Serguei Sokol via R-devel
>>>>>> on Mon, 18 Dec 2023 10:29:02 +0100 writes:
> > Le 17/12/2023 ? 18:26, Barry Rowlingson a ?crit?:
> >> I think what's been missed is that zapsmall works relative to the absolute
> >> largest value in the vector. Hence if
2023 Dec 18
1
[External] Re: zapsmall(x) for scalar x
Does mFUN() really need to be a function of x and the NA values of x? I
can't think of a case where it would be used on anything but the non-NA
values of x.
I think it would be easier to specify a different mFUN() (and document this
new argument) if the function has one argument and is applied to the non-NA
values of x.
zapsmall <- function(x,
digits = getOption("digits"),
2023 Dec 19
1
[External] Re: zapsmall(x) for scalar x
>>>>> Steve Martin
>>>>> on Mon, 18 Dec 2023 07:56:46 -0500 writes:
> Does mFUN() really need to be a function of x and the NA values of x? I
> can't think of a case where it would be used on anything but the non-NA
> values of x.
> I think it would be easier to specify a different mFUN() (and document this
> new argument)
2003 Oct 13
1
zapsmall with all values small (PR#4554)
Hi
If all values are small, zapsmall does not zap.
For example ...
> zapsmall(1e-24)
[1] 1e-24
> zapsmall(1e-24, digits=3)
[1] 1e-24
Problem appears to be in calculation of digits ...
mx <- max(abs(x[!ina]))
digits = if (mx > 0)
max(0, digits - log10(mx))
else
digits
If all values are small, mx is very small, log10(mx) is
2005 Mar 29
1
zapsmall (PR#7755)
Full_Name: Paul Vos
Version: 2.0.1
OS: windows XP
Submission from: (NULL) (150.216.148.20)
> zapsmall(.3-.2-.1,digits=7)
[1] -2.775558e-17
This should be zero. By changing the condition
if (mx > 0)
in zapsmall to
if (mx > 1)
we get
> zapsmall(.3-.2-.1,digits=7)
[1] 0
2023 Jul 07
1
printCoefmat() and zap.ind
>>>>> Shu Fai Cheung
>>>>> on Thu, 6 Jul 2023 17:14:27 +0800 writes:
> Hi All,
> I would like to ask two questions about printCoefmat().
Good... this function, originally named print.coefmat(),
is 25 years old (in R) now:
--------------------------------------------------------------------
r1902 | maechler | 1998-08-14 19:19:05 +0200 (Fri,
2008 Aug 04
1
simulate data based on partial correlation matrix
Given four known and fixed vectors, x1,x2,x3,x4, I am trying to
generate a fifth vector,z, with specified known and fixed partial
correlations.
How can I do this?
In the past I have used the following (thanks to Greg Snow) to
generate a fifth vector based on zero order correlations---however I'd
like to modify it so that it can generate a fifth vector with specific
partial
2008 Jun 18
1
Custom strips in lattice
I've recently been playing with strip functions for a data presentation I'd
like to use, and have a couple questions. I've cannibalised the
useOuterStrips function from latticeExtra to give me the following sample
code:
library(lattice)
myData <- expand.grid(
type = c('First 3 days','Whole profile'),
sub = paste('Subject', 1:3,
2003 May 14
1
Multiple comparison and lme (again, sorry)
Dear list,
As a reply to my recent mail:
> simint and TukeyHSD work for aov objects.
> Can someone point me to similar functions for lme objects?
Douglas Bates wrote
There aren't multiple comparison methods for lme objects because it is
not clear how to do multiple comparisons for these. I don't think the
theory of multiple comparisons extends easily to lme models. One
could
2008 Oct 29
1
FW: Re: linux batch question
Hi Phil: That's EXACTLY what it is. Thanks so much. It's nice to know
that the R Gods don't hate me. I hope it's okay that I'm going to cc
r-help
in case this thread comes up in the future and also so that other people
who might want to help know that it's solved. Thanks again.
On Wed, Oct 29, 2008 at 5:01 PM, Phil Spector wrote:
> Mark:
>
>> delete
2009 Jul 21
1
error when installing rjags
Hi All: I get the following error when trying to install the rjags package.
I've installed the
jags software and I'm using Fedora 10.0 and my sessionInfo is at the bottom
of this email.
I'm also sorry if this email ends up having control A's all over it. I still
haven't figured how to fix that. Thanks.
[1] "LOADING MASS LIBRARY"
checking for
2008 Oct 29
2
linux batch question
I usually just run my R programs at the R command prompt but for my
latest one I want to save any output that gets written to the screen so
I am
trying to use R CMD BATCH and send the output to an output file. I
realize I could use sink at the prompt but I'd rather try to do it this
way
because I know that I used to do this in S+.
So, I wrote a simple one line program called test.R which
2002 Jun 14
0
pretty() sometimes isn't
Hi all,
R> seq(-.4, .8, length=7)
[1] -4.000000e-01 -2.000000e-01 5.551115e-17 2.000000e-01 4.000000e-01
[6] 6.000000e-01 8.000000e-01
Well that may not be a "bug", but it has this unfortunate consequence:
R> pretty(c(-.4,.8))
[1] -4.000000e-01 -2.000000e-01 5.551115e-17 2.000000e-01 4.000000e-01
[6] 6.000000e-01 8.000000e-01
And thus my plot axes look funny
2002 Oct 29
1
pretty not pretty
Hi,
I have a following vector:
> smallch
[1] 0.0652840 0.1181300 0.0319370 0.0155700 0.0464110 0.0107850
[7] 0.0158970 0.0375900 0.0603090 0.0310300 0.0105920 0.0540580
[13] -0.0177740 0.0039393
Pretty (R 1.5.1) has problems with zero:
> pretty(smallch)
[1] -2.000000e-02 -3.469447e-18 2.000000e-02 4.000000e-02 6.000000e-02
[6] 8.000000e-02 1.000000e-01 1.200000e-01