modify rankall.R
modifying the script to a more generic function