Last active
May 3, 2019 03:52
-
-
Save shanmdphd/2afbcd0aa9aafa97bfa2ca79898545a1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
tibble(estimate = c(0.23, 0.52, 0.20, 0.03, 0.45, 0.05), | |
rse = c(55.9, 41.4, 45.1, 19.9, 46.6, 25.5)) %>% | |
mutate(lower_ci = estimate - 1.96 * rse/100 * estimate) %>% | |
mutate(upper_ci = estimate + 1.96 * rse/100 * estimate) %>% | |
mutate(ci = sprintf('%0.2f - %0.2f', round(lower_ci, 2), round(upper_ci, 2))) | |
# A tibble: 6 x 5 | |
estimate rse lower_ci upper_ci ci | |
<dbl> <dbl> <dbl> <dbl> <chr> | |
1 0.23 55.9 -0.0220 0.482 -0.02 - 0.48 | |
2 0.52 41.4 0.0981 0.942 0.10 - 0.94 | |
3 0.2 45.1 0.0232 0.377 0.02 - 0.38 | |
4 0.03 19.9 0.0183 0.0417 0.02 - 0.04 | |
5 0.45 46.6 0.0390 0.861 0.04 - 0.86 | |
6 0.05 25.5 0.0250 0.0750 0.03 - 0.07 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment