我的数据如下:
“Louis Hamilton”
“Tiger Wolf”
“Sachin Tendulkar”
“Lebron James”
“Michael Shoemaker”
“Hollywood – Career as an Actor”
我尝试使用以下功能,效果很好
sub("^([^- ]+).*", "\\1", v1)
现在,我该如何操作这些名称,以便输出如下?
“Louis Wolf”
“Tiger:5”
“Sachin James”
“Lebron Tendulkar”
“Michael – Actor”
“Hollywood: Shoemaker”