0

Suppose I have male and female age in a single column which is a huge dataset. How to split the male and female ages into two different columns?

Example

Sex Age

M 18

F 20

M 65

F 36

M 49

M 27

F 38

Suman Jai
  • 1
  • 1
  • 1
    If the dataframe is called `df` and column is `col` you can use `df <- tidyr::separate(df, 'col', c('Sex', 'Age'), sep = '\\s+')`. Also it would be easier to help if you create a small reproducible example along with expected output. Read about [how to give a reproducible example](http://stackoverflow.com/questions/5963269). – Ronak Shah Jul 20 '21 at 04:01
  • Thanks..Suppose M is given as 1 and F is given as 2..How to split it? – Suman Jai Jul 22 '21 at 06:17

0 Answers0