Open shannonpileggi opened 3 months ago
Suggested change to src/library/base/man/jitter.Rd
:
\arguments{
\item{x}{numeric vector to which \emph{jitter} should be added.}
\item{factor}{numeric vector of length one that scales the amount of jitter when \code{amount} is \code{NULL} or \code{0}.}
\item{amount}{\code{NULL} (\emph{default}) or numeric vector that specifies the amount of jitter. Passing \code{NULL} or \code{0} to \code{amount} selects a method for calculating the \code{amount}. See Details for more information on methods used.}
}
\description{
Add a small amount of noise to a numeric vector.
}
\value{
\code{jitter(x, \dots)} returns a numeric of the same length as
\code{x}, but with an \code{amount} of noise added in order to break
ties.
}
\details{
The result, say \code{r}, is \code{r <- x + runif(n, -a, a)}
where \code{n <- length(x)} and \code{a} is the \code{amount}
argument (if specified).
Let \code{z <- max(x) - min(x)} (assuming the usual case). The amount \code{a} to be added is either provided as \emph{positive}
argument \code{amount} or otherwise computed from \code{z}, as
follows:
If \code{amount} is \code{NULL} (\emph{default}), \code{factor * d / 5} is used, where \code{d} is the smallest difference between adjacent unique (apart from fuzz) \code{x} values.
If \code{amount == 0}, \code{a} is set using \code{factor * z / 50}.
}
Thanks @collinberke. It would be great if you could prepare a patch using the GitHub mirror of the R sources, as described here: https://contributor.r-project.org/rdevguide/FixBug.html#using-a-git-mirror. This will make it easier to see the changes that you are proposing.
.. and I hope you still keep my https://bugs.r-project.org/show_bug.cgi?id=17279#c3 in mind!
@hturner, I can do that. I was having trouble building the dev environment in our session last week, so I just dumped what we got done here. I'll work to get these changes into Bugzilla following your guidelines.
@mmaechler, certainly trying to keep your input in mind. New contributor to R Core, so I'll try my best. I'm open to any changes, suggestions, or rejections, though. This was tricky to explain.
@collinberke sending a reminder about this. If it helps to set aside some time you might join us at the R Dev Day @ LatinR!
On Bugzilla: Bug 17279- parameter "amount" is badly explained for jitter()
First submitted comment below, see Bugzilla for more discussion.