0

Let me share the data I am working with first, and then explain my struggle / what output I am hoping for:

head(my_df$HeightWeight)
"6-1 / 210"  "5-10 / 255" "5-10 / 165" "/" "6-0 / 200"  "5-11 / 185"

temp = c("6-1 / 210", "5-10 / 255", "5-10 / 165", "/", "6-0 / 200", "5-11 / 185")

The variable 'temp' is the dput() for what is displayed. This is height / weight information included in this column, and there are missing values (in my example the 4th is a missing value, represented as a /). I would like to split these into 2 columns, to get the following output:

head(new_df)
  Height     Weight
1    6-1        210
2   5-10        255
3   5-10        165
4     NA         NA
5    6-0        200 
6   5-11        185

it seems like this should be simple but I am struggling, any help appreciated!

Canovice
  • 9,012
  • 22
  • 93
  • 211

0 Answers0