I have the following string:
x <- "(((K05708+K05709+K05710+K00529) K05711),K05712) K05713 K05714 K02554"
# [1] "(((K05708+K05709+K05710+K00529) K05711),K05712) K05713 K05714 K02554"
and I want to split it by space delimiter avoiding what's inside the parentheses in order to have something like:
[[1]]
[1] "(((K05708+K05709+K05710 K00529) K05711),K05712)"
[2] "K05713" "K05714"
[4] "K02554"
See that two spaces remain inside the first parentheses level.
I read the following answers but I couldn't make it work in my case: r split on delimiter not in parentheses and Using strsplit() in R, ignoring anything in parentheses
Thanks in advance!