I have a data frame like this :
Screen.name party users
1 A_Gloeckner SPD @MartinSchulz.
2 A_Gloeckner SPD @MartinSchulz
3 A_Gloeckner SPD @ManuelaSchwesig @sigmargabriel @nahles
4 a_grotheer SPD @SouthendRNLI
5 a_grotheer SPD @ribasdiego10
6 a_grotheer SPD @HBBuergerschaft
7 a_grotheer SPD @UniBremen…
I would like to split the 3rd column and make the data frame look like this :
Screen.name party mentioned_users
1 A_Gloeckner SPD @MartinSchulz.
2 A_Gloeckner SPD @MartinSchulz
3 A_Gloeckner SPD @ManuelaSchwesig
4 A_Gloeckner SPD @sigmargabriel
5 A_Gloeckner SPD @nahles
6 a_grotheer SPD @SouthendRNLI
7 a_grotheer SPD @ribasdiego10
8 a_grotheer SPD @HBBuergerschaft
9 a_grotheer SPD @UniBremen…
I have tried so far this one: mention_polits_2017=mention_polits_2017[,list(mention_polits_2017=unlist(strsplit(mention_polits_2017,","))),by=mention_polits_2017$Screen.name]
But it is showing me an error, "Error in [.data.frame
(mention_polits_2017, , list(mention_polits_2017 = unlist(strsplit(mention_polits_2017, :
unused argument (by = mention_polits_2017$Screen.name)"
Thank you.