It's not done with one resistor, but two, forming a voltage divider: https://learn.sparkfun.com/tutorials/voltage-dividers