If you analyze the structure of the object you will see where the problem occurs:
atomic [1:4] 2 1 4 3
- attr(*, "levels")= chr [1:4] "10" "11" "15" "20"
dados$x is composed of the vector [2,1,4,3] with the
levels attribute. This attribute appears on the console when the
dados$x is printed.
To solve the problem, in addition to the solution already mentioned, you can adopt the following solution:
In the first part of the solution, the attributes of the object
dados$x are extracted and numbered.
R automatically places these values in ascending order. Then you use
[dados$x] to leave them in the original order.
This solution is slightly more efficient than
as.numeric(as.character(dados$x)) , though it may be harder to remember.