所以我目前有一个"追求" (显示在"标签"列中)。我需要将这些追求分解为单独的实例,具体取决于它们是处于活动状态还是非活动状态以及它们处于活动状态还是非活动状态的次数。我目前有:
datetime title label status option_title
1 2016-08-06 What is the current stage of this Pursuit? AIG <NA> 1 - Opportunity Review
2 2016-08-06 Pursuit status: AIG Active <NA>
3 2016-08-31 What is the current stage of this Pursuit? AIG <NA> 2 - Solution Review
4 2016-12-13 What is the current stage of this Pursuit? AIG <NA> 4 - Submit Proposal
5 2016-10-27 What is the current stage of this Pursuit? Allianz <NA> Pre-Qualification
6 2016-11-14 Pursuit status: Allianz Active <NA>
7 2017-05-18 What is the current stage of this Pursuit? Allianz <NA> 1 - Opportunity Review
8 2017-05-18 What is the current stage of this Pursuit? Allianz <NA> Pre-Qualification
9 2017-08-24 Pursuit status: Allianz Inactive <NA>
10 2016-10-27 What is the current stage of this Pursuit? Allianz <NA> Pre-Qualification
11 2016-11-14 Pursuit status: Allianz Active <NA>
12 2016-12-19 What is the current stage of this Pursuit? Allianz <NA> 1 - Opportunity Review
13 2017-04-14 What is the current stage of this Pursuit? Allianz <NA> 2 - Solution Review
我想得到:
datetime title label option_title
1 2016-08-06 What is the current stage of this Pursuit? AIG - Active1 1 - Opportunity Review
2 2016-08-31 What is the current stage of this Pursuit? AIG - Active1 2 - Solution Review
3 2016-12-13 What is the current stage of this Pursuit? AIG - Active1 4 - Submit Proposal
4 2016-10-27 What is the current stage of this Pursuit? Allianz - Active1 Pre-Qualification
5 2017-05-18 What is the current stage of this Pursuit? Allianz - Active1 1 - Opportunity Review
6 2017-05-18 What is the current stage of this Pursuit? Allianz - Active1 Pre-Qualification
7 2016-10-27 What is the current stage of this Pursuit? Allianz - Inactive1 Pre-Qualification
12 2016-12-19 What is the current stage of this Pursuit? Allianz - Active2 1 - Opportunity Review
13 2017-04-14 What is the current stage of this Pursuit? Allianz - Active2 2 - Solution Review
我假设可以使用&#34; datetime&#34;在dplyr中完成此操作。具有&#34;状态&#34;的字段领域,但我不确定如何接近它。有什么想法吗?
答案 0 :(得分:0)
按照预期,您似乎希望按标签排序列表&amp;日期。您可以在数组上调用sort函数来排序和实现逻辑以在块中进行排序。