0

I want to split a dataframe containing only 1 column with below values into two columns containing only the numeric values

1: [0.426321243245,0.573678756755]
2: [0.413189679382,0.586810320618]

I have tried different ways in R using dplr -starts_with,seperate etc but couldn't split the column into dataframe containing two seperate columns.

Can someone please help me with this?

Thanks,

A. Suliman
  • 12,923
  • 5
  • 24
  • 37
Naseer
  • 127
  • 10

1 Answers1

0

I hope this will help you

newdf <- read.table(text = "column1
0.426321243245,0.573678756755
0.413189679382,0.586810320618
", header = T)


library(splitstackshape)
final <- cSplit(newdf, 'column1', sep=",", type.convert=FALSE)
Hunaidkhan
  • 1,411
  • 2
  • 11
  • 21