Re: [R] Programming Question (setting ylim generally)

2009-01-09 Thread Gabor Grothendieck
Berwin Turlach has pointed out that to be equivalent to the original answer the code should be: plot(a, ylim = range(a) * (1 + 0.06 * c(-1,1))) On Fri, Jan 9, 2009 at 2:22 PM, Gabor Grothendieck wrote: > Or even: > > plot(a, ylim = range(a) + 0.06 * c(-1, 1)) > > > On Fri, Jan 9, 2009 at 2:07 PM

Re: [R] Programming Question (setting ylim generally)

2009-01-09 Thread stephen sefick
WOW, Gabor, that is fancy. I have gotten better at this R thing, but have far to go. That is a neat solution. thanks Stephen On Fri, Jan 9, 2009 at 2:22 PM, Gabor Grothendieck wrote: > Or even: > > plot(a, ylim = range(a) + 0.06 * c(-1, 1)) > > > On Fri, Jan 9, 2009 at 2:07 PM, Mike Prager w

Re: [R] Programming Question (setting ylim generally)

2009-01-09 Thread Gabor Grothendieck
Or even: plot(a, ylim = range(a) + 0.06 * c(-1, 1)) On Fri, Jan 9, 2009 at 2:07 PM, Mike Prager wrote: > "stephen sefick" wrote: > >> low <- min(a*0.98)-(min(a)*0.04) >> high <- max(a*1.02)+(max(a)*0.04) >> plot(a, ylim=c(low, high)) > > Unless I am misreading your example, this can be done a

Re: [R] Programming Question (setting ylim generally)

2009-01-09 Thread Mike Prager
"stephen sefick" wrote: > low <- min(a*0.98)-(min(a)*0.04) > high <- max(a*1.02)+(max(a)*0.04) > plot(a, ylim=c(low, high)) Unless I am misreading your example, this can be done a little more compactly as: plot(a, ylim = range(a * 0.94, a * 1.06)) -- Mike Prager, NOAA, Beaufort, NC * Opinions

Re: [R] Programming Question (setting ylim generally)

2009-01-09 Thread stephen sefick
WOW, I am not going to post after midnight. Thank you for your response, and this is what I settled on. `plot.e` <- function(b, w, x, y, z){ a <- window.chron(b, w, x, y, z) low <- min(a*0.98)-(min(a)*0.04) high <- max(a*1.02)+(max(a)*0.04) plot(a, ylim=c(low, high)) lines(a*0.98, col="blue") lin

Re: [R] Programming Question (setting ylim generally)

2009-01-09 Thread Gavin Simpson
On Fri, 2009-01-09 at 00:22 -0500, stephen sefick wrote: > library(StreamMetabolism) > plot.e <- function(b, w, x, y, z){ > a <- window.chron(b, w, x, y, z) > low <- min(b*0.98)+5 > high <- max(b*1.02)+5 > plot(a, ylim=c(low, high)) > lines(a*0.98, col="blue") > lines(a*1.02, col="red") > } > > p

Re: [R] programming question

2007-10-18 Thread jim holtman
I am not sure I understand your question. I get the following output from your code and it does not look like act.surv.time is repeated: > m treat strata time censorTime act.surv.time censoring [1,] 1 1 0.8331923 0.654723930.65472393 1 [2,] 1 1 0.33

Re: [R] programming question

2007-09-17 Thread Adrian Dusa
On Monday 17 September 2007, you wrote: > R 2.6.0 has Reduce; > > myvec <- c(2, 8, 24, 26, 51, 57, 58, 78, 219) > Reduce(function(myvec, p) setdiff(myvec, findSubsets2(p)), myvec, myvec) Thanks Gabor, at first I jumped off my chair but... for many input variables it takes to reduce the vector. M

Re: [R] programming question

2007-09-17 Thread Gabor Grothendieck
R 2.6.0 has Reduce; myvec <- c(2, 8, 24, 26, 51, 57, 58, 78, 219) Reduce(function(myvec, p) setdiff(myvec, findSubsets2(p)), myvec, myvec) On 9/16/07, Adrian Dusa <[EMAIL PROTECTED]> wrote: > > Dear list, > > I have a vector of numbers, let's say: > > myvec <- c(2, 8, 24, 26, 51, 57, 58, 78, 219