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

Popular posts from this blog

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

how can i manage url using .htaccess in php? -

ios - I get the error Property '...' not found on object of type '...' -