find_index = function(x)
{
  tmp = unique(sort(x))
  tmp2 = 1:length(tmp)
  names(tmp2) = as.character(tmp)
  as.numeric(tmp2[as.character(x)])
}
