Displaying 1 result from an estimated 1 matches for "x15_3".
Did you mean:
x153
2013 Apr 18
1
select and do some calculations/manipulations on certain rows based on conditions in R
...;
>
>I want to create a Y column where Y = 1 if there is an observation for the
>same ID right below it and if the Sum of the product of the X's =1 for the
>two consecutive observations of the same ID. Y=0 otherwise.
>
>So for example, ?Y3=1 because Sum(x0_3*x0_4+x1_3*x1_4+...+x15_3*x15_4)=1.
>
>Can I create program that can do the calculation for Y conditioning on the
>ID (i.e. if the ID changes then Y=0) and second conditioning on the sum of
>the product of the X's for two consecutive rows if the ID condition is met,
>i.e. ID stays the same?
>
>I am...