Re: [R] Select only cases with negative values

2008-10-20 Thread Martin Maechler
MJ == Michael Just [EMAIL PROTECTED] on Sat, 18 Oct 2008 17:26:02 -0400 writes: MJ Henrique, MJ This code below from a R-help helper worked. dat -data.frame(f) dat2-dat[dat$d0,] dat.lm -lm(c~d, data=dat2) But Henrique's advice, of using 'subset= d 0' was really

[R] Select only cases with negative values

2008-10-18 Thread Michael Just
Hello, I was wondering if there was a way to only select cases my from data frame that contained a negative value? c-c(1,2,3,4,5,6,7,8,9,10) d- c(-1,2,-3,-4,5,6,-7,8,-9,10) f - cbind(c,d) dat -data.frame(f) dat.lm -lm(c~d) If I wanted to only use the rows that had a negative value in column

Re: [R] Select only cases with negative values

2008-10-18 Thread Henrique Dallazuanna
Try this: dat.lm -lm(c~d, subset=d 0) On Sat, Oct 18, 2008 at 7:03 PM, Michael Just [EMAIL PROTECTED] wrote: Hello, I was wondering if there was a way to only select cases my from data frame that contained a negative value? c-c(1,2,3,4,5,6,7,8,9,10) d- c(-1,2,-3,-4,5,6,-7,8,-9,10) f -

Re: [R] Select only cases with negative values

2008-10-18 Thread Michael Just
Henrique, Thanks for the rapid response. I tried the following to no avail: dat.lm -lm(c~d, dat=dat, subset= d 0) Error in eval(expr, envir, enclos) : invalid 'envir' argument dat.lm -lm(c~d, dat=dat, subset= (d 0)) Error in eval(expr, envir, enclos) : invalid 'envir' argument dat.lm -lm(c~d,

Re: [R] Select only cases with negative values

2008-10-18 Thread Henrique Dallazuanna
Works for me. dat.lm -lm(c~d, data = dat, subset=d 0) Please see if you have dat with d and c columns names. On Sat, Oct 18, 2008 at 7:18 PM, Michael Just [EMAIL PROTECTED] wrote: Henrique, Thanks for the rapid response. I tried the following to no avail: dat.lm -lm(c~d, dat=dat, subset= d

Re: [R] Select only cases with negative values

2008-10-18 Thread Johannes Hüsing
Am 18.10.2008 um 23:03 schrieb Michael Just: Hello, I was wondering if there was a way to only select cases my from data frame that contained a negative value? c-c(1,2,3,4,5,6,7,8,9,10) d- c(-1,2,-3,-4,5,6,-7,8,-9,10) f - cbind(c,d) dat -data.frame(f) dat.lm -lm(c~d) If I wanted to only

Re: [R] Select only cases with negative values

2008-10-18 Thread Michael Just
Johannes, Thanks for the response. However, ... dat.neg - dat[dat$d 0, ] Error in dat[dat$d 0, ] : incorrect number of dimensions In addition: Warning message: $ operator is deprecated for atomic vectors, returning NULL in: dat$d Any other ideas? Thanks, Michael On Sat, Oct 18, 2008 at 5:18