0

I have a dataframe like below:

structure(list(tissue = c("thymus", "leg muscle", "liver", "stromal cell of bone marrow", 
"liver", "liver", "liver", "bone marrow", "skin", "balb/c"), 
    genotype = c("", "", "", "", "", "", "", "", "over-expressing PTN/OSF1,wild type genotype", 
    "")), row.names = c("S-4", "S-21", "S-25", "S-29", "S-47", "S-48", "S-49", "S-50", "S-61", "S-74"
), class = "data.frame")

This dataframe has two columns, one as tissue and the other as genotype which is a comma separated string. I would like to split the string based on comma and add rows with the splitted value and the same tissue.

stefan
  • 90,330
  • 6
  • 25
  • 51
Nmgh
  • 113
  • 7
  • 3
    Does this answer your question: [Split comma-separated strings in a column into separate rows](https://stackoverflow.com/questions/13773770/split-comma-separated-strings-in-a-column-into-separate-rows) – stefan Sep 26 '22 at 22:08
  • 1
    yes @stefen, I think I didnt use proper keywords to search. Thank you so much. – Nmgh Sep 26 '22 at 22:23

0 Answers0