I'm experiencing trouble with creating a new rank column. I have the following data:
Title Cat. Rank
The Da Vinci Code Book 19
The Da Vinci Code Book 19
The Da Vinci Code Book 19
Sisterhood.... Book 21
Book X Book 34
Book X Book 34
I need to create a new rank column based on the current rank column where Da Vinci code gets a 1 in all rows with da vinci code. When a new title appears the rank should change to a 2 etc.
I've been trying a lot of variations of rank, e.g.:
dt.reviews.books.new[,sales_rank_cat:=rank(title, ties.method="first"),by=title]
But this assigns a 1 to every title.