I have the following variable in a dataframe
test<-data.frame(x=c("", "1-7-9", "3", "2-4-6-8"))
I want to splits that in variables like:
Var1 Var2 Var3 Var4
NA NA NA NA
1 7 9
3 NA NA NA
2 4 6 8
I have tried
test2<-strsplit(as.character(vartest$x), "\\-")
but I get a list rather a dataframe
Please help me
Aucun commentaire:
Enregistrer un commentaire