【发布时间】:2021-06-15 19:37:10
【问题描述】:
我有一个如下所示的数据框:
name strand
thrL 1
thrA 1
thrB 1
yaaA -1
yaaJ -1
talB 1
mog 1
我想将前几个正值分组,将负值分组,下一个正数作为另一个组,如下所示:
name strand directon
thrL 1 1
thrA 1 1
thrB 1 1
yaaA -1 2
yaaJ -1 2
talB 1 3
mog 1 3
我正在考虑使用 dplyr,但我需要一些关于使用 R 的代码的帮助。非常感谢。
【问题讨论】: