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
better (in most respects I'd say). If it really did not work for you,
you have a strange (or broken?) R environment.

Again back to your example 

 c - 1:10
 d - c(-1,2,-3,-4,5,6,-7,8,-9,10)
 f - cbind(c,d)
 dat - data.frame(f)
 rm(c,d,f) ##  check to make sure 'c' or 'd' are not picked up from GlobalEnv 
[MM]
 ## 
 daN.lm -lm(c ~ d, data = dat, subset = d  0)
 summary(daN.lm)

Does this really not work for you?

Martin Maechler, ETH Zurich

MJ Thanks again,
MJ Michael Just

MJ On Sat, Oct 18, 2008 at 5:22 PM, Henrique Dallazuanna [EMAIL 
PROTECTED] wrote:
 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.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[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 d
for my regression, how could I make that selection?

Thanks,
Michael Just

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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 - 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 d
 for my regression, how could I make that selection?

 Thanks,
 Michael Just

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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, dat=dat, subset= c(d 0))
Error in eval(expr, envir, enclos) : invalid 'envir' argument

Any other suggestions?
Thanks,
Michael Just

On Sat, Oct 18, 2008 at 5:15 PM, Henrique Dallazuanna [EMAIL PROTECTED] wrote:
 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 - 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 d
 for my regression, how could I make that selection?

 Thanks,
 Michael Just

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




 --
 Henrique Dallazuanna
 Curitiba-Paraná-Brasil
 25° 25' 40 S 49° 16' 22 O


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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 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, dat=dat, subset= c(d 0))
 Error in eval(expr, envir, enclos) : invalid 'envir' argument

 Any other suggestions?
 Thanks,
 Michael Just

 On Sat, Oct 18, 2008 at 5:15 PM, Henrique Dallazuanna [EMAIL PROTECTED] 
 wrote:
 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 - 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 d
 for my regression, how could I make that selection?

 Thanks,
 Michael Just

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




 --
 Henrique Dallazuanna
 Curitiba-Paraná-Brasil
 25° 25' 40 S 49° 16' 22 O





-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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 use the rows that had a negative value in column d
for my regression, how could I make that selection?




untested:
dat[dat$d  0, ]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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 PM, Johannes Hüsing [EMAIL PROTECTED] wrote:

 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 use the rows that had a negative value in column d
 for my regression, how could I make that selection?



 untested:
 dat[dat$d  0, ]



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.