Dear all,
I would like to thank you for you answers
This worked for me

Browse[1]> match(Test,seq(1,C,FrN),nomatch=FALSE)
  [1]   1   0   2   3   0   0   4   0   0   5   0   0   6   7   0   0   8   0
 [19]   0   9   0  10  11   0   0  12   0   0  13  14   0  15   0  16   0   0
 [37]  17  18  19   0   0  20  21  22  23   0   0  24   0  25   0   0  26   0
 [55]   0  27  29   0  30  31   0  32   0   0  33  34   0   0  37   0  38   0
 [73]   0   0  39   0  40   0  41   0  42  43  46  47   0  48   0   0  49  51
 [91]   0   0  52   0  53   0   0  54  55   0   0  56   0  57  58  59   0   0
[109]  60  61   0   0  62  63  64  65  67  68  69  70  71  72  73  74  75   0
[127]  76  77  79   0  80   0  81  82  83  84  85  86   0  87   0  88  89  90
[145]   0   0  91  92  93  94   0  95   0  96  97  98  99   0   0 100   0   0
[163] 101 102   0   0 103   0   0   0 104   0   0 105   0   0 106   0 107   0
[181] 108   0 109 110 111   0   0 112   0 113   0 114   0 115 116 117 118 119
[199] 120 121 122 123 124 125 126 127 129 130 131 132 133 134 135   0 136 137
[217]   0 138   0 139 140 141   0 142   0   0 143 144   0   0 145   0 146   0
[235]   0 147   0 148 149 150   0 151 152 153   0   0 154 156 157 158   0 159
[253] 160 161 162 163 164 165 166 167   0 168 169 170 171 172 173   0   0 174
[271]   0 175 176 177 178 179 180 181 182 183 184 185   0 186 187   0 188   0
[289] 189 190 191 192   0 193 194 195 196 197 198 199 200


What I want to do now is to keep all the vector elements (only numbers) without 
the zeros!. How I can do that?

B.R
Alex



________________________________
From: William Dunlap <wdun...@tibco.com>

Sent: Saturday, October 1, 2011 12:11 AM
Subject: RE: [R] is member



Someone already suggested that you use match(),
which does what I think you want.  Read its help file
for details.
 
> A <- seq(1,113,4)
> match(c(9, 17, 18), A)
[1]  3  5 NA
 
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com 

Sent: Friday, September 30, 2011 2:07 PM
To: William Dunlap; R-help@r-project.org
Subject: Re: [R] is member
 
Thanks a lot! This works.
Now I want to do the opposite
let's say that I have one sequence 
for example 
check in image 
http://imageshack.us/photo/my-images/4/unleduso.png/
column A (this is a seq(1,113,4)
and I want when I get the number 9 to say that this is the third number in the 
seq (1,113,4). everything about the seq(1,113,4) is known and I want when I get 
one of the number of the sequence to say which is its order.
How I can do that?
B.R
A;ex
 
From:William Dunlap <wdun...@tibco.com>

Sent: Friday, September 30, 2011 6:34 PM
Subject: RE: [R] is member

  is.element(myvector, seq(1,800,4))
or, if you like typing percent signs,
  myvector %in% seq(1,800,4)

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com 

> -----Original Message-----
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
> Behalf Of Alaios
> Sent: Friday, September 30, 2011 9:26 AM
> To: R-help@r-project.org
> Subject: [R] is member
> 
> Dear all,
> I have a vector with number that some of them are part of the
> 
> seq(1,800,4). How can I check which of the numbers belong to the seq(1,800,4)
> 
> LEt's say that is called myvector the vector with the numbers.
> Is there in R something like this?
> is.member(myvector,seq(1,800,4))
> 
> I would like to thank you in advance for your help
> 
> B.R
> Alex
>     [[alternative HTML version deleted]]
        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to