search for: pifferdavide

Displaying 3 results from an estimated 3 matches for "pifferdavide".

2017 Jul 23
1
matching element of a vector to i-2nd element
...t; Bert > Bert Gunter > > "The trouble with having an open mind is that people keep coming along > and sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > > On Sun, Jul 23, 2017 at 11:43 AM, Davide Piffer <pifferdavide at gmail.com> wrote: >> I have a df with a vector v. For each element of the vector, I want to >> know whether the i-2nd element is the same as the ith element. For >> example: >> given >> v=c(A,C,D,C) the result should be: >> FALSE,FALSE,FALSE,TRUE. >>...
2017 Jul 23
0
matching element of a vector to i-2nd element
...homework policy on this list. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Sun, Jul 23, 2017 at 11:43 AM, Davide Piffer <pifferdavide at gmail.com> wrote: > I have a df with a vector v. For each element of the vector, I want to > know whether the i-2nd element is the same as the ith element. For > example: > given > v=c(A,C,D,C) the result should be: > FALSE,FALSE,FALSE,TRUE. > > I attempted something u...
2017 Jul 23
4
matching element of a vector to i-2nd element
I have a df with a vector v. For each element of the vector, I want to know whether the i-2nd element is the same as the ith element. For example: given v=c(A,C,D,C) the result should be: FALSE,FALSE,FALSE,TRUE. I attempted something using indexing in a for loop such as (bad, incorrect example): for (i in v){ if [i]==[i-2] print T else print F } However, this is obviously wrong. Can someone