Jason Ching Yuk Jason Ching Yuk - 1 year ago 64
R Question

Splitting Columns that contain decimal point values in R

I facing difficulties splitting columns in R. For instance

and over 100x records

I did

tidyr::separate(df, Col1.Col2.Col3,
c("Col1", "Col2", "Col3" ))

And i get

Col1 Col2 Col3
12 3 10
11 3 11
85 89 3
and over 100x records

I realised that the decimal value is moved to the next column and the values of Col3 were left out. How can i fix this or is there a better way of splitting the columns?

Answer Source

tidyr::separate has a sep argument that controls where the splits occur. Use sep = ",".

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download