0
Follow
0
View

Calculated field based on string value of another column R

lucky_xu123 注册会员
2023-01-25 19:41

Let DF be your data frame.

## solution 1
DF$Session <- rep(1:(nrow(DF) / 2), each = 2)

## solution 2
DF$Session <- cumsum(DF$Status == "START")

About the Author

Question Info

Publish Time
2023-01-25 19:41
Update Time
2023-01-25 19:41