That’s a part of my data:
structure(list(Testa = c(-1L, -1L, -1L,
-1L, -1L, -1L, -1L, -1L), Pre = c(NaN, NaN, NaN,
NaN, NaN, NaN, NaN, NaN), Fract = c(NaN, NaN,
NaN, NaN, NaN, NaN, NaN, NaN), Terms = c(-1L,
-1L, -1L, -1L, -1L, -1L, -1L, -1L), Time = c(NaN,
NaN, NaN, NaN, NaN, NaN, NaN, NaN), Matches = c("y15", "b6", "b7",
"b11", "y9", "b8(2+)", "y10(3+)", "b12(5+)")), row.names = c(NA,
-8L), class = c("tbl_df", "tbl", "data.frame"))
Let’s focus on column Matches
. I would like to divide it to three columns Matches2
, etc.. and fill up with the scheme like below – desired output:
Take a first character (letter: y or b) to first column, in second column should be a next character – number after the letter and in last column should be a number from bracket ()
without + and the one which do not have a bracket at all should be filled with number 1
.