【发布时间】:2020-07-23 11:39:31
【问题描述】:
我首先应该承认,我真的很难为我所面临的复杂问题找到一个合适的标题。
我有以下数据:
configuration_id TARGET_CLASS UniqueIdentifier BranchCoverage Total_Branches Size Length Generations Statements_Executed CoverageTimeline_T1 CoverageTimeline_T2 CoverageTimeline_T3
ar_statement com.browsersoft.aacs.User NA 67559dfd 1 60 46 108 NA 108 0.8158776539 0.8381375035
ar_statement com.browsersoft.aacs.User efe4cbdc 1 60 44 103 240 1087446 0.7525773196 0.7540513682 0.7661337337
ar_statement com.browsersoft.aacs.User NA aac8afa6 1 60 43 104 NA 177 0.765031271 0.8062749834
ar_statement com.browsersoft.aacs.User 8567c4bd 1 60 45 105 388 NA 0.8680720145 0.9386218251 0.9484536082
ar_statement com.browsersoft.aacs.User 94e45912 1 60 43 101 118 NA 0.8767466262 0.9471901622 0.9690721649
如您所见,UniqueIdentifier 列中有 NA。 NA 将同一行中的值推到右侧;正确的值在右栏中。我想要的是删除 NA 并将其替换为下一列值,例如:
configuration_id TARGET_CLASS UniqueIdentifier BranchCoverage Total_Branches Size Length Generations Statements_Executed CoverageTimeline_T1 CoverageTimeline_T2 CoverageTimeline_T3
ar_statement com.browsersoft.aacs.User 67559dfd 1 60 46 108 108 NA 0.8158776539 0.8381375035
ar_statement com.browsersoft.aacs.User efe4cbdc 1 60 44 103 240 1087446 0.7525773196 0.7540513682 0.7661337337
ar_statement com.browsersoft.aacs.User aac8afa6 1 60 43 104 177 NA 0.765031271 0.8062749834
ar_statement com.browsersoft.aacs.User 8567c4bd 1 60 45 105 388 NA 0.8680720145 0.9386218251 0.9484536082
ar_statement com.browsersoft.aacs.User 94e45912 1 60 43 101 118 NA 0.8767466262 0.9471901622 0.9690721649
为了更清楚,对于那些UniqueIdentifier 为 NA 的行,然后将每一列的值替换为下一列中的值(这就像将值推回)。
我希望我的问题很清楚。
我该怎么做?
【问题讨论】:
标签: r