Bonjour.
J'ai besoin de découper le chemin d'une colonne d'un data frame et le repartir dans plusieurs colonnes. Voici un exemple de data frame de départ:
et voici l'objectif a atteindre:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 d <- data.frame( user = c("user3","user2","user3","user1","user1","user3"), pdc = c("123", "46", "123", "17", "17", "123"), action = c("open","followlike","open","followlike","open","followlike"), cible = c( NA, "\\\\A\\B\\C\\D\\file_42.png", NA, "\\\\A\\B\\C\\D\\file_19.png", NA, "\\\\A\\B\\C\\D\\file_21.png" ) )
une idée sur la façon de faire ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 d1 <- data.frame( user = c("user3","user2","user3","user1","user1","user3"), pdc = c("123", "46", "123", "17", "17", "123"), action = c("open","followlike","open","followlike","open","followlike"), cible = c( NA, "\\\\A\\B\\C\\D\\file_42.png", NA, "\\\\A\\B\\C\\D\\file_19.png", NA, "\\\\A\\B\\C\\D\\file_21.png" ), dir1 = c(NA,"A",NA,"A",NA,"A"), dir2 = c(NA,"B",NA,"B",NA,"B"), dir3 = c(NA,"C",NA,"C",NA,"C"), dir4 = c(NA,"D",NA,"D",NA,"D"), file = c(NA,"file_42.png",NA,"file_19.png",NA,"file_21.png") )
Partager