I have a column of data where I am trying to remove all characters which aren't numbers The data looks like:
Col1
Name=12_Represse, Name=12_Represse, Name=12_Represse, Name=13_Heterochrom/l, Name=13_Heterochrom/lo
Name=13_Heterochrom/lo
Name=11_Weak_Tx, Name=11_Weak_Tx, Name=11_Weak_Tx, Name=11_Weak_Tx, Name=11_Weak_Tx, Name=11_Weak_Tx
The output I expect is:
Col1
12,12,12,13,13
13
11,11,11,11,11,11
I've tried to adapt from other questions which look to remove specific strings. For example trying:
test <- str_replace_all(data$col1,"#[a-z,A-Z]*","")
However this, or similar adaptations where I have tried gsub, does not seem to work. I am new to R so any guidance would help.