From 79e5268f2b8491b2ea68822e650888b441eb156f Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Tue, 7 Apr 2020 18:17:34 +0200 Subject: [PATCH] remove tibble dependence --- .github/workflows/check-full.yaml | 2 +- DESCRIPTION | 1 - NAMESPACE | 5 ++--- R/bf_corr_test.R | 7 ++++--- R/helpers_bf_tests.R | 13 +++++-------- R/reexports.R | 8 ++++---- codemeta.json | 12 ------------ docs/reference/bf_corr_test.html | 14 +++++++------- docs/reference/bf_expr.html | 7 ++----- docs/reference/bf_extractor.html | 6 ++++-- docs/reference/reexports.html | 8 ++------ man/bf_corr_test.Rd | 7 ++++--- man/bf_expr.Rd | 7 ++----- man/bf_extractor.Rd | 6 ++++-- man/reexports.Rd | 4 +--- tests/testthat/test-bf_expr.R | 13 +++++++++---- 16 files changed, 51 insertions(+), 69 deletions(-) diff --git a/.github/workflows/check-full.yaml b/.github/workflows/check-full.yaml index e9b7008..2150a83 100644 --- a/.github/workflows/check-full.yaml +++ b/.github/workflows/check-full.yaml @@ -19,7 +19,7 @@ jobs: matrix: config: - {os: windows-latest, r: '3.6', args: "--no-manual"} - - {os: windows-latest, r: 'devel', args: "--no-manual"} + #- {os: windows-latest, r: 'devel', args: "--no-manual"} - {os: macOS-latest, r: '3.6', args: "--no-manual"} #- {os: macOS-latest, r: 'devel', args: "--no-manual"} - {os: ubuntu-16.04, r: '3.6', cran: "https://demo.rstudiopm.com/all/__linux__/xenial/latest", args: "--no-manual"} diff --git a/DESCRIPTION b/DESCRIPTION index f42bfa3..25a16fb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -27,7 +27,6 @@ Imports: ipmisc, metaBMA, rlang, - tibble, tidyr Suggests: ggplot2, diff --git a/NAMESPACE b/NAMESPACE index 50710a8..569fbc9 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -38,11 +38,13 @@ importFrom(ipmisc,"%$%") importFrom(ipmisc,"%<-%") importFrom(ipmisc,"%<>%") importFrom(ipmisc,"%>%") +importFrom(ipmisc,as_tibble) importFrom(ipmisc,blue) importFrom(ipmisc,long_to_wide_converter) importFrom(ipmisc,red) importFrom(ipmisc,signif_column) importFrom(ipmisc,specify_decimal_p) +importFrom(ipmisc,tibble) importFrom(metaBMA,meta_random) importFrom(metaBMA,prior) importFrom(rlang,"!!") @@ -53,8 +55,5 @@ importFrom(rlang,enquo) importFrom(rlang,ensym) importFrom(rlang,new_formula) importFrom(rlang,quo_is_null) -importFrom(tibble,as_tibble) -importFrom(tibble,enframe) -importFrom(tibble,tibble) importFrom(tidyr,drop_na) importFrom(tidyr,uncount) diff --git a/R/bf_corr_test.R b/R/bf_corr_test.R index 7441861..3fe85c6 100644 --- a/R/bf_corr_test.R +++ b/R/bf_corr_test.R @@ -22,7 +22,7 @@ #' # for reproducibility #' set.seed(123) #' -#' # to get caption (default) +#' # to see results #' bf_corr_test( #' data = anscombe, #' x = x1, @@ -30,12 +30,13 @@ #' bf.prior = 1 #' ) #' -#' # to see results +#' # to get caption #' bf_corr_test( #' data = anscombe, #' x = x1, #' y = y4, -#' bf.prior = 0.8 +#' bf.prior = 0.8, +#' output = "null" #' ) #' @export diff --git a/R/helpers_bf_tests.R b/R/helpers_bf_tests.R index 6deaf7f..a0f8548 100644 --- a/R/helpers_bf_tests.R +++ b/R/helpers_bf_tests.R @@ -5,9 +5,11 @@ #' @param ... Currently ignored. #' #' @importFrom BayesFactor extractBF -#' @importFrom tibble enframe #' @importFrom dplyr rename select mutate #' +#' @note *Important*: don't enter `1/bf_obj` to extract results for null +#' hypothesis; # doing so will return wrong results. +#' #' @examples #' set.seed(123) #' @@ -20,8 +22,6 @@ #' ) #' #' # extracting Bayes Factors in a dataframe -#' # *important*: don't enter `1/bf_obj` to extract results for null hypothesis; -#' # doing so will return wrong results #' bf_extractor(bf_obj) #' @export @@ -72,17 +72,14 @@ bf_extractor <- function(bf.object, ...) { #' #' # creating caption (for null) #' bf_expr( -#' bf.df = bf.df, +#' bf.df, #' output = "null", #' k = 3, #' caption = "Note: Iris dataset" #' ) #' #' # creating caption (for alternative) -#' bf_expr( -#' bf.df = bf.df, -#' output = "alternative" -#' ) +#' bf_expr(bf.df, output = "alternative") #' } #' @export diff --git a/R/reexports.R b/R/reexports.R index 198c96e..5884244 100644 --- a/R/reexports.R +++ b/R/reexports.R @@ -40,12 +40,12 @@ rlang::`%||%` rlang::`%|%` #' @export -#' @importFrom tibble tibble -tibble::tibble +#' @importFrom ipmisc tibble +ipmisc::tibble #' @export -#' @importFrom tibble as_tibble -tibble::as_tibble +#' @importFrom ipmisc as_tibble +ipmisc::as_tibble # ----------------------- metaBMA ------------------------------------- diff --git a/codemeta.json b/codemeta.json index 0aef22d..93ed11a 100644 --- a/codemeta.json +++ b/codemeta.json @@ -177,18 +177,6 @@ }, "sameAs": "https://CRAN.R-project.org/package=rlang" }, - { - "@type": "SoftwareApplication", - "identifier": "tibble", - "name": "tibble", - "provider": { - "@id": "https://cran.r-project.org", - "@type": "Organization", - "name": "Comprehensive R Archive Network (CRAN)", - "url": "https://cran.r-project.org" - }, - "sameAs": "https://CRAN.R-project.org/package=tibble" - }, { "@type": "SoftwareApplication", "identifier": "tidyr", diff --git a/docs/reference/bf_corr_test.html b/docs/reference/bf_corr_test.html index 4ae30b0..c2f1542 100644 --- a/docs/reference/bf_corr_test.html +++ b/docs/reference/bf_corr_test.html @@ -199,7 +199,7 @@

Examp
# for reproducibility set.seed(123) -# to get caption (default) +# to see results bf_corr_test( data = anscombe, x = x1, @@ -209,16 +209,16 @@

Examp #> bf10 error bf01 log_e_bf10 log_e_bf01 log_10_bf10 log_10_bf01 bf.prior #> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 0.550 0 1.82 -0.597 0.597 -0.259 0.259 1

-# to see results +# to get caption bf_corr_test( data = anscombe, x = x1, y = y4, - bf.prior = 0.8 -)
#> # A tibble: 1 x 8 -#> bf10 error bf01 log_e_bf10 log_e_bf01 log_10_bf10 log_10_bf01 bf.prior -#> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> -#> 1 0.607 0 1.65 -0.499 0.499 -0.217 0.217 0.8
+ bf.prior = 0.8, + output = "null" +)
#> atop(displaystyle(NULL), expr = paste("In favor of null: ", "log"["e"], +#> "(BF"["01"], ") = ", "0.50", ", ", italic("r")["Cauchy"]^"JZS", +#> " = ", "0.80"))
# creating caption (for alternative) -bf_expr( - bf.df = bf.df, - output = "alternative" -)
#> atop(displaystyle(NULL), expr = paste("In favor of alternative: ", +bf_expr(bf.df, output = "alternative")
#> atop(displaystyle(NULL), expr = paste("In favor of alternative: ", #> "log"["e"], "(BF"["10"], ") = ", "99.77", ", ", italic("r")["Cauchy"]^"JZS", #> " = ", "0.71"))
# }
diff --git a/docs/reference/bf_extractor.html b/docs/reference/bf_extractor.html index 0ec795a..5705b7d 100644 --- a/docs/reference/bf_extractor.html +++ b/docs/reference/bf_extractor.html @@ -145,6 +145,10 @@

Arg +

Note

+ +

Important: don't enter 1/bf_obj to extract results for null +hypothesis; # doing so will return wrong results.

Examples

set.seed(123) @@ -158,8 +162,6 @@

Examp ) # extracting Bayes Factors in a dataframe -# *important*: don't enter `1/bf_obj` to extract results for null hypothesis; -# doing so will return wrong results bf_extractor(bf_obj)

#> # A tibble: 1 x 7 #> bf10 error bf01 log_e_bf10 log_e_bf01 log_10_bf10 log_10_bf01 #> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> diff --git a/docs/reference/reexports.html b/docs/reference/reexports.html index bf4def6..32cd2ed 100644 --- a/docs/reference/reexports.html +++ b/docs/reference/reexports.html @@ -52,14 +52,12 @@ @@ -141,14 +139,12 @@

Objects exported from other packages

These objects are imported from other packages. Follow the links below to see their documentation.

-
ipmisc

%$%, %<-%, %<>%, %>%, long_to_wide_converter, signif_column, specify_decimal_p

+
ipmisc

%$%, %<-%, %<>%, %>%, as_tibble, long_to_wide_converter, signif_column, specify_decimal_p, tibble

metaBMA

prior

rlang

%|%, %||%

-
tibble

as_tibble, tibble

-
diff --git a/man/bf_corr_test.Rd b/man/bf_corr_test.Rd index 7236746..b481e65 100644 --- a/man/bf_corr_test.Rd +++ b/man/bf_corr_test.Rd @@ -51,7 +51,7 @@ Bayesian correlation test. # for reproducibility set.seed(123) -# to get caption (default) +# to see results bf_corr_test( data = anscombe, x = x1, @@ -59,12 +59,13 @@ bf_corr_test( bf.prior = 1 ) -# to see results +# to get caption bf_corr_test( data = anscombe, x = x1, y = y4, - bf.prior = 0.8 + bf.prior = 0.8, + output = "null" ) } \seealso{ diff --git a/man/bf_expr.Rd b/man/bf_expr.Rd index a0d7a0b..2815380 100644 --- a/man/bf_expr.Rd +++ b/man/bf_expr.Rd @@ -44,16 +44,13 @@ bf.df <- # creating caption (for null) bf_expr( - bf.df = bf.df, + bf.df, output = "null", k = 3, caption = "Note: Iris dataset" ) # creating caption (for alternative) -bf_expr( - bf.df = bf.df, - output = "alternative" -) +bf_expr(bf.df, output = "alternative") } } diff --git a/man/bf_extractor.Rd b/man/bf_extractor.Rd index 46764e9..f6055d9 100644 --- a/man/bf_extractor.Rd +++ b/man/bf_extractor.Rd @@ -14,6 +14,10 @@ bf_extractor(bf.object, ...) \description{ Extract Bayes Factors from \code{BayesFactor} model object. } +\note{ +\emph{Important}: don't enter \code{1/bf_obj} to extract results for null +hypothesis; # doing so will return wrong results. +} \examples{ set.seed(123) @@ -26,7 +30,5 @@ bf_obj <- ) # extracting Bayes Factors in a dataframe -# *important*: don't enter `1/bf_obj` to extract results for null hypothesis; -# doing so will return wrong results bf_extractor(bf_obj) } diff --git a/man/reexports.Rd b/man/reexports.Rd index 30350c2..d721fd6 100644 --- a/man/reexports.Rd +++ b/man/reexports.Rd @@ -22,12 +22,10 @@ These objects are imported from other packages. Follow the links below to see their documentation. \describe{ - \item{ipmisc}{\code{\link[ipmisc]{\%$\%}}, \code{\link[ipmisc]{\%<-\%}}, \code{\link[ipmisc]{\%<>\%}}, \code{\link[ipmisc]{\%>\%}}, \code{\link[ipmisc]{long_to_wide_converter}}, \code{\link[ipmisc]{signif_column}}, \code{\link[ipmisc]{specify_decimal_p}}} + \item{ipmisc}{\code{\link[ipmisc]{\%$\%}}, \code{\link[ipmisc]{\%<-\%}}, \code{\link[ipmisc]{\%<>\%}}, \code{\link[ipmisc]{\%>\%}}, \code{\link[ipmisc]{as_tibble}}, \code{\link[ipmisc]{long_to_wide_converter}}, \code{\link[ipmisc]{signif_column}}, \code{\link[ipmisc]{specify_decimal_p}}, \code{\link[ipmisc]{tibble}}} \item{metaBMA}{\code{\link[metaBMA]{prior}}} \item{rlang}{\code{\link[rlang]{\%|\%}}, \code{\link[rlang]{\%||\%}}} - - \item{tibble}{\code{\link[tibble]{as_tibble}}, \code{\link[tibble]{tibble}}} }} diff --git a/tests/testthat/test-bf_expr.R b/tests/testthat/test-bf_expr.R index 821277c..5401665 100644 --- a/tests/testthat/test-bf_expr.R +++ b/tests/testthat/test-bf_expr.R @@ -8,10 +8,15 @@ testthat::test_that( # bayes factor results set.seed(123) - bf_results <- tibble::tribble( - ~log_e_bf01, ~bf.prior, - 1.1, 0.88 - ) + bf_results <- + structure( + list(log_e_bf01 = 1.1, bf.prior = 0.88), + row.names = c( + NA, + -1L + ), + class = c("tbl_df", "tbl", "data.frame") + ) # expected using1 <- bf_expr(