I have this vector:
n <- c("alberto queiroz souza (alberto, q-s.)",
"alberto queiroz souza (alberto, queiroz souza)",
"alberto queiroz souza (alberto, q. s.)",
"alberto queiroz souza (alberto, q c)",
"bernardo josé silva (bernardo, j. s.)",
"bernardo josé silva (bernardo, j. silva)",
"josé césar pereira (josé, c. p.)",
"josé césar pereira (josé, c. pereira)")
For each element I would like to separate the name from the parentheses.
n <- str_split_fixed(as.character(n), " \(", 2)
n <- c(strsplit(as.character(n), "\)$"))
I do not know how to do this split better
transforming into another vector with non-duplicate elements.
result would look like this:
result <- c("alberto queiroz souza",
"bernardo josé silva",
"josé césar pereira",
"alberto, q-s.",
"alberto, queiroz souza",
"alberto, q. s." ...... )