Skip to content

Commit

Permalink
fixing the number of studies in the legend of the zcurve.plot() function
Browse files Browse the repository at this point in the history
  • Loading branch information
FBartos committed Jan 7, 2022
1 parent 6d12432 commit 0b57181
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: zcurve
Title: An Implementation of Z-Curves
Version: 2.1.1
Version: 2.1.2
Authors@R: c(
person("František", "Bartoš", email = "f.bartos96@gmail.com", role = c("aut", "cre")),
person("Ulrich", "Schimmack", email = "ulrich.schimmack@utoronto.ca", role = c("aut")))
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## version 2.1.2
- Fixing number of statistically significant studies displayed in the annotation of z-curve plot.

## version 2.1.1
- Allowing to pass the xlim and ylim arguments to the z-curve plot function.

Expand Down
4 changes: 2 additions & 2 deletions R/main.R
Original file line number Diff line number Diff line change
Expand Up @@ -735,10 +735,10 @@ plot.zcurve <- function(x, annotation = FALSE, CI = FALSE, extrapolate
graphics::text(x.anno, y_max*y.anno[1] , paste0("Range: ",.r2d(min(x$data))," to ",.r2d(max(x$data))),
adj = c(0, 0), cex = cex.anno)

graphics::text(x.anno, y_max*y.anno[2] , paste0(length(x$data), " tests, ", sum(x$data >= x$control$a), " significant"),
graphics::text(x.anno, y_max*y.anno[2] , paste0(x_summary$model$N_all, " tests, ", x_summary$model$N_sig, " significant"),
adj = c(0, 0), cex = cex.anno)

obs_proportion <- stats::prop.test(sum(x$data >= x$control$a), length(x$data))
obs_proportion <- stats::prop.test(x_summary$model$N_sig, x_summary$model$N_all)
graphics::text(x.anno, y_max*y.anno[3] , paste0("Observed discovery rate:"),
adj = c(0, 0), cex = cex.anno)
graphics::text(x.anno, y_max*y.anno[4] , paste0(.r2d(obs_proportion$estimate), " 95% CI [", .r2d(obs_proportion$conf.int[1]), " ,",
Expand Down

0 comments on commit 0b57181

Please sign in to comment.