df
Chromosome aaChange
1 16 p.E548fs
2 16 p.S64X
3 16 p.P23H
4 16 p.G18V
5 16 p.L251S
I'm trying to extract numbers from aaChange, namely 584, 64, 23, 18, 251. I've run the code below:
df <- tidyr::extract(df, aaChange, into = 'Protein_position', ".*(\\d+).*",
remove = F, convert = T)
But the output is:
df
Chromosome aaChange Protein_position
1 16 p.E548fs 8
2 16 p.S64X 4
3 16 p.P23H 3
4 16 p.G18V 8
5 16 p.L251S 1
I dont know how to modify the regex. Any help is appreciated.