Skip to content

Commit 2233cae

Browse files
authored
Fix ggplot2 related bug (#34)
* Fix ggplot2 related bug * Version * URL * Travis
1 parent 7c22a23 commit 2233cae

File tree

9 files changed

+24
-19
lines changed

9 files changed

+24
-19
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ r_packages:
99
- covr
1010

1111
after_success:
12-
- Rscript -e 'covr::codecov(line_exclusions = list("R/bandit.R", "src/init.cpp", "R/plotDists.R" = 78:104, "R/makePlots.R" = 43:95, "R/dists.R" = 42:48))'
12+
- Rscript -e 'covr::codecov(line_exclusions = list("R/bandit.R", "src/init.cpp", "R/plotDists.R" = 80:106, "R/makePlots.R" = 43:95, "R/dists.R" = 42:48))'

DESCRIPTION

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@ Package: bayesAB
22
Type: Package
33
Title: Fast Bayesian Methods for AB Testing
44
Version: 1.1.2
5-
Date: 2019-01-17
5+
Date: 2019-07-02
66
Authors@R: person("Frank", "Portman", email = "frank1214@gmail.com", role = c("aut", "cre"))
77
Description: A suite of functions that allow the user to analyze A/B test
88
data in a Bayesian framework. Intended to be a drop-in replacement for
99
common frequentist hypothesis test such as the t-test and chi-sq test.
1010
License: MIT + file LICENSE
1111
Imports:
1212
Rcpp (>= 0.12.4),
13-
ggplot2 (>= 3.0.0),
14-
methods
13+
ggplot2 (>= 3.2.0),
14+
methods,
15+
rlang (>= 0.4.0)
1516
LinkingTo: Rcpp
1617
RoxygenNote: 6.1.0
1718
Encoding: UTF-8

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export(rename)
3232
importFrom(Rcpp,evalCpp)
3333
importFrom(graphics,par)
3434
importFrom(methods,is)
35+
importFrom(rlang,.data)
3536
importFrom(stats,dbeta)
3637
importFrom(stats,dgamma)
3738
importFrom(stats,dlnorm)

R/bayesAB.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#' @importFrom methods is
3636
#' @importFrom stats dbeta dnorm qgamma quantile rbeta rgamma rnorm dgamma dpois qpois runif dlnorm qlnorm pnorm var
3737
#' @importFrom utils tail packageVersion head
38+
#' @importFrom rlang .data
3839
#' @useDynLib bayesAB
3940
#' @importFrom Rcpp evalCpp
4041
NULL

R/bayesTest.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
#'
8484
#' @note For 'closed form' tests, you do not get a distribution over the posterior, but simply P(A > B) for the parameter in question.
8585
#'
86-
#' Choosing priors correctly is very important. Please see http://fportman.com/blog/bayesab-0-dot-7-0-plus-a-primer-on-priors/ for a detailed example of choosing priors
86+
#' Choosing priors correctly is very important. Please see http://fportman.com/writing/bayesab-0-dot-7-0-plus-a-primer-on-priors/ for a detailed example of choosing priors
8787
#' within bayesAB. Here are some ways to leverage objective/diffuse (assigning equal probability to all values) priors:
8888
#'
8989
#' \itemize{\item \code{Beta}(1, 1)

R/plotDists.R

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#' \item \link{plotPoisson}
1616
#' }
1717
#'
18-
#' @note Choosing priors correctly is very important. Please see http://fportman.com/blog/bayesab-0-dot-7-0-plus-a-primer-on-priors/ for a detailed example of choosing priors
18+
#' @note Choosing priors correctly is very important. Please see http://fportman.com/writing/bayesab-0-dot-7-0-plus-a-primer-on-priors/ for a detailed example of choosing priors
1919
#' within bayesAB. Here are some ways to leverage objective/diffuse (assigning equal probability to all values) priors:
2020
#'
2121
#' \itemize{\item \code{Beta}(1, 1)
@@ -34,28 +34,30 @@ plotDist_ <- function(support, hseq, dist, params) {
3434

3535
discretes <- c('Poisson')
3636

37-
ribbon_or_bar <- ggplot2::geom_ribbon(ymin = 0,
38-
ymax = hseq,
37+
ribbon_or_bar <- ggplot2::geom_ribbon(ggplot2::aes(ymax = .data$hseq),
38+
ymin = 0,
3939
size = 2,
4040
color = I("lightblue"),
4141
fill = "lightgreen",
4242
alpha = .25)
4343

4444
if(dist %in% discretes) {
45-
ribbon_or_bar <- ggplot2::geom_bar(stat = "identity",
45+
ribbon_or_bar <- ggplot2::geom_col(size = 2,
4646
color = I("lightblue"),
4747
fill = "lightgreen",
48-
alpha = .25,
49-
size = 2)
48+
alpha = .25)
5049
notEmpty <- hseq != 0
5150
support <- support[notEmpty]
5251
hseq <- hseq[notEmpty]
5352
}
5453

54+
# Done after the if statement because we have to delete some stuff for discrete case
55+
data <- data.frame(support, hseq)
56+
5557
paramList <- sapply(names(params), function(p) paste(p, params[p], sep = " = ", collapse = ""), USE.NAMES = FALSE)
5658
paramList <- paste0(paramList, collapse = ", ")
5759

58-
p <- ggplot2::qplot(x = support, y = hseq, geom = "line") +
60+
p <- ggplot2::ggplot(data, ggplot2::aes(support, hseq)) +
5961
ggplot2::xlab(NULL) +
6062
ggplot2::ylab('PDF') +
6163
ggplot2::ggtitle(paste0(

cran-comments.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
## Version 1.1.1 Submission
2-
Minor release mainly for fixing bugs around the newest version of ggplot2. Two other minor bug fixes for functions to make them more correct.
1+
## Version 1.1.2 Submission
2+
Minor release for fixing a bug caused by latest release of ggplot2. No API changes.
33

44
## Test environments
5-
- local OS X install, R 3.5.1
6-
- ubuntu 12.04 (on travis-ci), R 3.5.1
5+
- local OS X install, R 3.6.0
6+
- ubuntu 14.04 (on travis-ci), R 3.6.0
77
- win-builder (devel and release)
88

99
## R CMD check results
10-
There were no ERRORs or WARNINGs.
10+
There were no ERRORs,WARNINGs, or NOTEs.
1111

1212
## Dependencies
1313
There are currently no dependencies for this package.

man/bayesTest.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/plotDistributions.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)