library(dplyr)
library(tidyr)
example <- data.frame(data=c("Annie;7;4;1%;3%;Luciana;9;4%;2%;Lucas;1;2;3;7%;10%"))
And i need to separate it so every name has the proper information in the same column. Also, i do not know how long the "data" is, so i created a long vector with names
names<- paste0("name ",1:70,"")
And i separated the example like this:
example <- example %>% separate(data,into=c(names),sep="(%;[A-z])")
In this way i am able to separate all the cases, but i am missing the first and the last character (the only one that cares is the first one):
Thank you, Andres. Your answer was really close to do it. It was my mistake: I am sorry, I am quite new with this and i had to edit the example that i used and now it is complete.
In this case, your solution is quite close to solve it, but you regex separates each sample in two ways.
With your help i have a hint about how to solve it: with a " Lookbehind"