You're using a factor:
fert <- factor(c(50,20,10,10,20,50))
levels(fert)
#[1] "10" "20" "50"
Factors are always in a sequential form with labels:
as.numeric(fert)
#[1] 3 2 1 1 2 3
# corresponding to the labels of:
# 50 20 10 10 20 50
That's why:
levels(fert)[c(3,2,1,1,2,3)]
#[1] "50" "20" "10" "10" "20" "50"
You get this:
levels(fert)[fert]
#[1] "50" "20" "10" "10" "20" "50"