Amended script so that it creates categories from unique values of the given vector