Quantcast

Delete duplicate elements in String

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Delete duplicate elements in String

ets21152
This post has NOT been accepted by the mailing list yet.
Hello everyone,
I`ve got some problems deleting duplicate elements in a string.
My data look similar to this:

idvisit       path

1            1,16,23,59
2            2,14,14,19
3            5,19,23,19
4            10,10
5            23,23,27,29,23
...          ....

I have a column containing an unique ID and a column containing a path for web page navigation.
The right column contains some cases, where pages just were reloaded and the page were tracked twice or even more.
The pages are separeted with commas und are saved as factors.
My problem is, that i don´t want to have multipe pages in a row, so the data should look like this.

idvisit       path

1            1,16,23,59
2            2,14,19
3            5,19,23,19
4            10
5            23,27,29,23
...          ....
The multiple pages next to each other should be removed. I know how to delete a specific multiple number using regexpressions, but a have about 20.000 different pages and can´t do this for all of them.
Does anyone have a solution or a hint, for my problem?

Thanks
Sebastian
Loading...