I have a huge set of data with multiple columns, such as x1, x2, x3...... x25, y1, y2, y3...... y50, z1, z2....... z10etc, which looks something like this:
x1 x2 x3 x4 y1 y2 y3
1 2 1 2 1 1 2
2 1 1 1 3 1 1
1 2 2 1 1 2 1
I want to:
x_mean x_min x_max x_mad y_mean y_min y_max y_mad
1.5 1 2 0.74 2 1 2 0
1.25 1 2 0 2 1 2 0
1.5 1 2 0.74 2 1 2 0
Basically, I need to calculate min, max, mad(mean absolute deviation) andmean
> x_mean = (x1+x2+x3+x4)/4 = (1+2+1+2)/4
and similarly for other lines and other characteristics. How to do this in R, preferably in dplyr?
source
share