I've got a column people$food
that has entries like chocolate
or apple-orange-strawberry
.
I want to split people$food
by -
and get the first entry from the split.
In python, the solution would be food.split('-')[0]
, but I can't find an equivalent for R.