Hello, I have written a long piece of code to get data and create confidence intervals using BinomCI. I'm not sure you want to see all that. I am attempting to create 2 additional columns for grouped indicators showing the confidence limits of a comparator but I get an error:
df <- df %>%
- group_by(IndicatorNm) %>%
- mutate(BrLCI = lwr.ci[geotype == "CCG"]) %>%
- mutate(BrUCI = upr.ci[geotype == "CCG"])
Error: Column BrLCI must be length 46 (the group size) or one, not 0
I have tried ungrouping as solutions suggest to do that but the error just changes to:
Error: Column BrLCI must be length 986 (the number of rows) or one, not 20
I have 20 groups (indicators).
The annoying thing is I have written another script to achieve the same ends and it works ok.
Any help gratefully received
Thanks