Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 206235

Adjusted mean for each row in r

$
0
0

Aiming to reduce the impact of outliers in calculating mean of each row, I want to develop a ruled based mean function. In the below df for example:

2   3   4   5   3   4   5   6   80  3   3
4   5   2   4   5   5   2   4   4   56  3
2   33  4   44  3   4   5   6   80  3   2
1   3   4   1   3   4   5   6   80  3   3
66  66  2   4   5   66  2   4   3   56  3
2   33  4   44  3   4   5   6   80  3   2
22  55  33  33  44  25  34  38  31  34  2

So for each row, in a new dataframe (the current one should remain untouched), I want to replace all the numbers that are greater with {current mean(row)} and then get a new mean(row) with the replaced numbers.

The new mean should be inserted in a new column to be compared with the current mean. Any new scientific method to address the same problem is highly appreciated.


Viewing all articles
Browse latest Browse all 206235

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>