I have a clickstream .csv data file in this format :
Step_Name Session_ID Category
p-1 1 A
p-1 1 A
p-1 1 A
p-2 1 A
defer 1 A
p-1 2 B
p-3 2 B
p-3 2 B
buy 2 B
p-2 3 A
p-3 3 A
defer 3 A
I want to remove the duplicate steps within a Session_ID(Example : 3 p-1 steps in Session_ID = 1 should count as 1 p-1 step) and transpose the Step_Name column to get a count of the number of steps for each Category.
Category p-1 p-2 p-3 p-4 buy defer
A 1 2 1 0 0 2
B 1 0 1 0 1 0
I am working on this in RStudio.