0

I have looked through similar examples but struggling to get this to work with my data. I want to split one column of data into two, Ortho Group and Score.

enter image description here

ThomasIsCoding
  • 96,636
  • 9
  • 24
  • 81
rozza375
  • 3
  • 1
  • use `separate` from `tidyverse` read [documentation](https://www.rdocumentation.org/packages/tidyr/versions/0.8.3/topics/separate) – AnilGoyal Jan 25 '21 at 11:40

2 Answers2

1

Assuming df is the name of your data frame, you can try tstrsplit from data.table, e.g.,

library(data.table)
setDT(df)[,tstrsplit(Orthogroup.Mean_Identity,",")]
ThomasIsCoding
  • 96,636
  • 9
  • 24
  • 81
1

Using separate from the tidyr package and assuming your data is called df:

separate(df, col = Orthogroup.Mean_Identity, sep = ",", into = c("Orthogroup", "Mean_Identity"))
Moritz Schwarz
  • 2,019
  • 2
  • 15
  • 33