Displaying 2 results from an estimated 2 matches for "f1_mean".
2007 Nov 13
2
Getting mean in a dataframe
...2 1
>> 6 C 6 0
>> 7 C 2 0
>> 8 C 6 0
>>
>> and would like to calculate a new column
>> with mean-values, following this rule
>>
>> 1. If F1 = 0 calculate the mean from V2
>> for each factor in V1.
>>
>> 2. If F1 = 1, then F1_mean = 0
>>
>> So, the new DF should look like this
>>
>> V1 V2 F1 F1_mean
>> 1 A 2 0 2.5
>> 2 A 3 0 2.5
>> 3 A 4 1 0.0
>> 4 B 3 0 3.0
>> 5 B 2 1 0.0
>> 6 C 6 0 7.0
>> 7 C 2 0 7.0
>&g...
2007 Nov 23
0
R users in Cyprus
...> 3 A 4 1
> 4 B 3 0
> 5 B 2 1
> 6 C 6 0
> 7 C 2 0
> 8 C 6 0
>
> and would like to calculate a new column
> with mean-values, following this rule
>
> 1. If F1 = 0 calculate the mean from V2
> for each factor in V1.
>
> 2. If F1 = 1, then F1_mean = 0
>
> So, the new DF should look like this
>
> V1 V2 F1 F1_mean
> 1 A 2 0 2.5
> 2 A 3 0 2.5
> 3 A 4 1 0.0
> 4 B 3 0 3.0
> 5 B 2 1 0.0
> 6 C 6 0 7.0
> 7 C 2 0 7.0
> 8 C 6 0 7.0
>
> Thank you for any hel...