假设我有这些数据,
(df <- data.frame( col1 = c('My','Your','His','Thir'), col2 = c('Cat','Dog','Fish','Dog')))
col1 col2
1 My Cat
2 Your Dog
3 His Fish
4 Thir Dog
我想像这样组合列
`some magic`
col1 col2 col3
1 My Cat My Cat
2 Your Dog Your Dog
3 His Fish His Fish
4 Thir Dog Thir Dog
我该怎么办?甚至可能像这样使用逗号(,),
`some magic`
col1 col2 col3
1 My Cat My, Cat
2 Your Dog Your, Dog
3 His Fish His, Fish
4 Thir Dog Thir, Dog