0

I have data set in the following format

Ids                             Country
98643                           USA
98175 98181 98185 98191 98194   AUSTRALIA
98570                           GERMANY
98848 98824                     ITALY

and what I need is the data in the following format

Ids Country
98643   USA
98175   AUSTRALIA
98181   AUSTRALIA
98185   AUSTRALIA
98191   AUSTRALIA
98194   AUSTRALIA
98570   GERMANY
98848   ITALY
98824   ITALY

If anyone could help me in transforming the data in R programming it would be very helpful.

Shree
  • 10,835
  • 1
  • 14
  • 36
Mave
  • 31
  • 1

1 Answers1

0

Using tidyr -

yourdf %>% separate_rows(Ids, sep = " ")
Shree
  • 10,835
  • 1
  • 14
  • 36