I have the following dataframe:
df=read.table(text="A
hwqnewqn,ENS.1kmsdf,jmewhqjwjenj
jjqweq3w,eqwejnqwe,ENS.gkhkgfdlsl.jkmwejre
ENSAAAAAAAAAAAA,bbbbbbbb,cccccccc", header=TRUE)
Let's say I need a new column B with only the string between commas that somehow match ENS
So end result should be:
df=read.table(text="B
ENS.1kmsdf
ENS.gkhkgfdlsl.jkmwejre
ENSAAAAAAAAAAAA", header=TRUE)
Is there any approach for that?
In base R, you could use
vapplywithstrsplitto test for "ENS" usinggrepl: