Update rankhospital.R

Appended with test code.