I have a question that I have not found an answer for. There are similar questions whose solutions don't quite work in my situation. I have a data set that has four columns like this example:
Name Session Sequence Page
Bob 001 001 home
Bob 001 002 news
Bob 001 003 contact_us
Bob 001 004 home
Sally 001 001 home
Sally 001 002 contact_us
Bob 002 001 home
John 001 001 home
John 001 002 about_us
What I would like is something like this
Name Session Pages
Bob 001 home-news-contact_us-home
Sally 001 home-contact_us
Bob 002 home
John 001 home-about-us
Now the trick is that Sequence can be from 1:44, or anywhere in between. I am coding in R and have SQLite available. I also need to concatenate in the dashes, but that is easy. If R had something like 'lag' in SAS this would be a snap.