Update rankall.R

Appended with test code.