Re: [R] How can I find negative items from a vector with a short command?

2013-05-08 Thread jpm miao
Thanks, but why does f[f=4] yield 16 instead of 4? f [1] -24 -8 16 -32 64 -128 f[f0] [1] -2 -8 -32 -128 f[f0] [1] 4 16 64 f[f=4] [1] 16 2013/5/8 Jorge I Velez jorgeivanve...@gmail.com f [ f 0 ] On Wed, May 8, 2013 at 11:54 AM, jpm miao miao...@gmail.com wrote:

Re: [R] How can I find negative items from a vector with a short command?

2013-05-08 Thread jpm miao
Sorry. I just got it f[f==4] [1] 4 2013/5/8 jpm miao miao...@gmail.com Thanks, but why does f[f=4] yield 16 instead of 4? f [1] -24 -8 16 -32 64 -128 f[f0] [1] -2 -8 -32 -128 f[f0] [1] 4 16 64 f[f=4] [1] 16 2013/5/8 Jorge I Velez

Re: [R] How can I find negative items from a vector with a short command?

2013-05-08 Thread Jorge I Velez
Check ?== and try f[f == 4] More in section 2.4 at http://cran.r-project.org/doc/manuals/R-intro.pdf On Wed, May 8, 2013 at 5:14 PM, jpm miao miao...@gmail.com wrote: Thanks, but why does f[f=4] yield 16 instead of 4? f [1] -24 -8 16 -32 64 -128 f[f0] [1] -2 -8

[R] How can I find negative items from a vector with a short command?

2013-05-07 Thread jpm miao
Hi, I have a vector f with some negative columns. I remember that there is an easy expression that can find out negative items. Can someone tell me how I can do it? It seems to be f[i such that f[i]0 ...] Thanks, Miao d-1:7 f-(-2)^d f [1] -24 -8 16 -32 64 -128

Re: [R] How can I find negative items from a vector with a short command?

2013-05-07 Thread Pascal Oettli
Hi, The solution can be easily found on Internet. By the way, the following does what you are looking for: f[f0] Regards, Pascal On 05/08/2013 10:54 AM, jpm miao wrote: Hi, I have a vector f with some negative columns. I remember that there is an easy expression that can find out

Re: [R] How can I find negative items from a vector with a short command?

2013-05-07 Thread Jorge I Velez
f [ f 0 ] On Wed, May 8, 2013 at 11:54 AM, jpm miao miao...@gmail.com wrote: Hi, I have a vector f with some negative columns. I remember that there is an easy expression that can find out negative items. Can someone tell me how I can do it? It seems to be f[i such that f[i]0