R - Remove commas from values in a column and place separated values into new rows -
i have column of gene symbols have retrieved directly database, , of rows contain 2 or more symbols comma separated (see example below).
slc6a13 atp5j2-ptcd1,bud31,ptcd1 acot7 bud31,pdap1 ttc26
i remove commas, , place separated symbols new rows so:
slc6a13 atp5j2-ptcd1 bud31 ptcd1 acot7 bud3 pdap1 ttc26
i haven't been able find straight forward way in r, have suggestions?
another option use readlines
, strsplit
:
unlist(strsplit(readlines(textconnection(txt)),',')) "slc6a13" "atp5j2-ptcd1" "bud31" "ptcd1" "acot7" "bud31" "pdap1" "ttc26"
Comments
Post a Comment