I have a problem with the cut function. I have this situation:
codice
1 11GP2-0016
2 11GP2-0016
3 11GP2-0016
4 11OL2-074
5 11OL2-074
and I would like to have a new variable “campione” splitted by variable “codice” like this:
codice campione
1 11GP2-0016 [1,3]
2 11GP2-0016 [1,3]
3 11GP2-0016 [1,3]
4 11OL2-074 (4,5]
5 11OL2-074 (4,5]
How can I use the cut function to split the “codice” creating a variable showing that from 1 to 3 i have the same code, from 4 to 5 same code and so on?
I need to solve another question. For the same issue I would like to obtain:
codice campione
1 11GP2-0016 [11GP2-0016,11GP2-0016,11GP2-0016]
2 11GP2-0016 [11GP2-0016,11GP2-0016,11GP2-0016]
3 11GP2-0016 [11GP2-0016,11GP2-0016,11GP2-0016]
4 11OL2-074 (11OL2-074,11OL2-074]
5 11OL2-074 (11OL2-074,11OL2-074]
Is there any solution to do this?
This will do it. You can add brackets/parens, if you want.