Would this function be worth submitting to some existing cran library?
I'd be willing to document it and add error-checking if there is
somewhere that it belongs (with credit to Greg of course, unless Greg
wants to submit it himself).
I am using it in conjunction with a function I wrote which dra
*Thank you* Greg, this function works perfectly! I had imagined that
the ideal solution would iteratively modify the vector to fix new
violations of mindiff created by each subsequent spreading of tight
clusters, but couldn't figure how to do it. A small note, the vector
x must be sorted before u
-Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Levi Waldron
> Sent: Saturday, March 22, 2008 7:03 PM
> To: R-help mailing list
> Subject: [R] "spreading out" a numeric vector
>
> I am creating a timeline plot, but runn
Levi Waldron wrote:
> I am creating a timeline plot, but running into a problem in positions
> where the values to plot are too close together to print the text
> without overlap...
Hi Levi,
This may not be what you want, but spread.labels in the plotrix package
tries to evenly space labels for u
On Sat, Mar 22, 2008 at 9:58 PM, jim holtman <[EMAIL PROTECTED]> wrote:
> Is this close to what you want?
>
> > spread <- function(x, mindiff=0.5){
> + unique(as.integer(x / mindiff) * mindiff)
> + }
>
> >
> > x <- c(1,2,seq(2.1,2.3,0.1),3,4)
> > x
> [1] 1.0 2.0 2.1 2.2 2.3 3.0 4.0
> > s
Is this close to what you want?
> spread <- function(x, mindiff=0.5){
+ unique(as.integer(x / mindiff) * mindiff)
+ }
>
> x <- c(1,2,seq(2.1,2.3,0.1),3,4)
> x
[1] 1.0 2.0 2.1 2.2 2.3 3.0 4.0
> spread(x)
[1] 1 2 3 4
>
> spread(x,.2)
[1] 1.0 2.0 2.2 3.0 4.0
>
On Sat, Mar 22, 2008 at 8:03 PM, L
I am creating a timeline plot, but running into a problem in positions
where the values to plot are too close together to print the text
without overlap. The simplest way I can think of to solve this
(although there may be other ways?) is to create a new numeric vector
whose values are as close as
7 matches
Mail list logo