【发布时间】:2021-11-27 14:33:38
【问题描述】:
我在哪里添加 runif(1,0,8) 我希望它是每一行的不同数字,但目前它是相同的随机数。如何迭代地遍历行以分配不同的值以每次添加?谢谢!
mutate(enter_sim_time = arrive_hrs) %>% #add column for arrival time
mutate(exc_flag = rbinom(demand, 1, runif(1,0.34,0.37))) %>% #add a column to flag whether a work item is routed to exceptions or not
mutate(exc_enter_sim_time = ifelse(exc_flag == 1, enter_sim_time + runif(1,0,8), enter_sim_time))```
【问题讨论】: