Calculating the trimmed mean as an estimator My book provides the following steps to calculate the $ 100 \alpha$ percent trimmed mean for a sample data of $n$ measurments:

1-Order the measurments.

2-Discard the smallest $100\alpha$ percent and the largest $100\alpha$ percent of the measurments.

3-Compute the arthimetic mean of the remaining measurments.

Could one explain these steps preferably with an example.
 A: Using R, to illustrate a 10% trimmed mean of a sample of size $n = 20$ from $\mathsf{Pois}(\lambda = 30).$
set.seed(2020)
x = rpois(20, 30)
mean(x)
[1] 30.75

The regular (untrimmed) sample mean is $\bar X = 30.75.$
x.sort = sort(x)
x.sort
 [1] 21 23 24 26 27 28 28 30 30 30
[11] 31 31 32 32 32 33 34 36 37 50

10% of $n = 20$ is 2, so temporarily disregard the first two
and the last 2 observations:
x.temp = x.sort[3:18]
x.temp
 [1] 24 26 27 28 28 30 30 30 31 31
[11] 32 32 32 33 34 36

Take the mean of the remaining (central) sixteen observations.
mean(x.temp)
[1] 30.25

So the 10% trimmed mean of the sample x is $30.25.$
Finally, all in one step, with trim parameter:
mean(x, trim=.1)
[1] 30.25

However, the original sample x remains unchanged:
length(x)
[1] 20
mean(x)
[1] 30.75

Notes: (1) The 50% trimmed mean is the median:
median(x)
[1] 30.5
mean(x, trim=.5) 
[1] 30.5

(2) Caution: If the 'trimming fraction' of the sample does not amount to an integer number of observations to ignore, then R will down-weight an extreme value at each end.
[You should know that this happens, in case you get unexpected
results. But trying to emulate the exact result by hand computation might be frustrating.]
mean(x, trim=.08);  mean(x, trim=.1)
[1] 30.22222
[1] 30.25

