Problem solved:
DF = data.frame(read.table(textConnection("A B C D E
1 1 a 1999 1 0
2 1 b 1999 0 1
3 1 c 1999 0 1
4 1 d 1999 1 0
5 2 c 2001 1 0
6 2 d 2001 0 1
7 3 a 2004 0 1
8 3 b 2004 0 1
9 3 d 2004 0 1
10 4 b 2001 1 0
11 4 c 2001 1
Thanks, learned something new again. About my second question:
You're right, the input rows are similar, but "cumsum(z) - z" generates
dissimilar output rows. The rule I want to define is: if input rows are
repeated, replace the output row with the minimum value of the output row.
So (the differe
On Wed, Feb 23, 2011 at 8:32 AM, mathijsdevaan wrote:
> Hi,
>
> I have two questions:
> 1. How do I combine "DF$F =" and "DF$G =" into one function? (The original
> dataset contains many more columns for which I want to execute the same
> operation)
Just define a function that can handle multiple
Hi,
I have two questions:
1. How do I combine "DF$F =" and "DF$G =" into one function? (The original
dataset contains many more columns for which I want to execute the same
operation)
2. How do I improve the ave function so that the value DF(12,G) = 0 instead
of 1 (see bold font)? Both DF(12,B)=
4 matches
Mail list logo