dplyr::mutate to add multiple values

前端 未结 6 1591
旧时难觅i
旧时难觅i 2020-11-30 04:15

There are a couple of issues about this on the dplyr Github repo already, and at least one related SO question, but none of them quite covers my question -- I think.

6条回答
  •  爱一瞬间的悲伤
    2020-11-30 04:36

    This uses a "standard" dplyr workflow, but as @BenBolker notes in the comments, it requires calling get_binCI twice:

    dd %>% group_by(x,n) %>%
      mutate(lwr=get_binCI(x,n)[1],
             upr=get_binCI(x,n)[2])
    
      x  n        lwr       upr
    1 3 10 0.06673951 0.6524529
    2 4 11 0.10926344 0.6920953
    

提交回复
热议问题