First of all I'm not sure if I titled this topic right but I hope description will clear everything.
Firstly, I had data frame like this
vehicle type number1 number2
"car" "truck, SUV, hatchback" 2 3
"bike" "scraper, lowrider" 5 7
"plane" "bomber" 2 3
Secondly, I've used great cSplit
function from splitstackshape
to change this data frame to something like this
vehicle type1 type2 type3 number1 number2
"car" "truck" "SUV" "hatchback" 2 3
"bike" "scraper" "lowrider" NA 5 7
"plane" "bomber" NA NA 2 3
But as my final result I would like to see something like this
vehicle type number1 number2
"car" "truck" 2 3
"car" "SUV" 2 3
"car" "hatchback" 2 3
"bike" "scraper" 5 7
"bike" "lowrider" 5 7
"plane" "bomber" 2 3
And obviously I have no idea how to do this and I don't even know if topic describes my problem enough (I have feeling that package tidy may be helpful). Thank you in advance