1

I have a situation where my dataset has a column which consists of the full sequence of directed google Analytics user page pathways(I.e. sequence of pages/nodes in chain). Is there a function/library or trick to convert that sequence into individual rows representing edges (i.e a directed pair of node/user pages) ?

My scenario(the full sequence column has values like) :

A->B->C

C->D

A->X

Z

I expect a output like below after processing:

A->B

B->C

C->D

A->X

Z-> Null ---- this represents that it is a leaf node also meaning that the user has reached the last page of his journey and there exists no next node/page in his journey

MrFlick
  • 195,160
  • 17
  • 277
  • 295
hawk06955
  • 11
  • 1
  • Are values like "A->B->C" just string values? It's better to share data in a [reproducible format](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) like `dput()` just to be clear exactly how data is formatted. Do you have any changes that are longer than 3 elements? – MrFlick Jun 01 '22 at 21:41
  • Thanks for the reply. Yes the values are string. And the sequence can be very long for example when user goes to 50th page then he will generate a value till 50th edge/page sequence. In my example I kept it short as for a solution if exists for the short one should definitely work for the long sequence as well :) - @hawk06955 – hawk06955 Jun 01 '22 at 22:02

0 Answers0