diff --git a/DESCRIPTION b/DESCRIPTION index 6008faa..0261627 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: dynutils Type: Package Title: Common Functionality for the 'dynverse' Packages -Version: 1.0.4 +Version: 1.0.5 Authors@R: c( person( "Robrecht", @@ -22,11 +22,11 @@ Description: Provides common functionality for the 'dynverse' packages. 'dynverse' is created to support the development, execution, and benchmarking of trajectory inference methods. For more information, check out . -License: GPL-3 -URL: http://github.com/dynverse/dynutils +License: MIT + file LICENSE +URL: https://github.com/dynverse/dynutils BugReports: https://github.com/dynverse/dynutils/issues LazyData: TRUE -RoxygenNote: 6.1.1 +RoxygenNote: 7.0.2 Depends: R (>= 3.0.0) Imports: assertthat, crayon, desc, dplyr, magrittr, Matrix, methods, proxyC, purrr, Rcpp, remotes, stringr, tibble @@ -35,10 +35,10 @@ LinkingTo: Rcpp Encoding: UTF-8 VignetteBuilder: knitr NeedsCompilation: yes -Packaged: 2019-10-03 09:35:39 UTC; rcannood +Packaged: 2020-02-21 10:46:37 UTC; rcannood Author: Robrecht Cannoodt [aut, cre] (, rcannood), Wouter Saelens [aut] (, zouter) Maintainer: Robrecht Cannoodt Repository: CRAN -Date/Publication: 2019-10-03 11:40:05 UTC +Date/Publication: 2020-02-21 12:30:02 UTC diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..97966f6 --- /dev/null +++ b/LICENSE @@ -0,0 +1,2 @@ +YEAR: 2014-2020 +COPYRIGHT HOLDER: Robrecht Cannoodt, Wouter Saelens diff --git a/MD5 b/MD5 index 7b34eb0..b164acf 100644 --- a/MD5 +++ b/MD5 @@ -1,18 +1,19 @@ -7cb192d75db723701f71178d68b024c8 *DESCRIPTION +1dedbdd446a71fb6e0cd7acf0c4f8865 *DESCRIPTION +ef3d9f056adaa322680184035912700f *LICENSE b6dec4db1cd993e42ffd95d92cba8d64 *NAMESPACE -297d7883e7e41507719df466d52d1237 *NEWS.md +3cd2614695426b6226bf22cc46ee6cc2 *NEWS.md dcdf2491b0e62a545623862a87d55529 *R/RcppExports.R 6f7fc8ddd74f0326bf2b59a523681cf7 *R/add_class.R 93ee58dfa8e9d0165a0aadbc62cfb01a *R/assertions.R 0567136a0ea7179450e01daec3b56c88 *R/calculate_distance.R d6aa6f13af04adf14f579e08fc13d984 *R/calculate_mean.R -d12293c4bf7b1a545afd8a8772ef9160 *R/check_packages.R +e2b7b0caa56d6a39e5f74f05f1ba7546 *R/check_packages.R 1a1b2bac9aa0637569d9de821ce01da4 *R/development.R ebced609202a59d493b476c3aac3fe8d *R/expand_matrix.R aa0987fdaaa50b3bf720eef589eb9cbe *R/extend_with.R a13cca47e183757563216d56990fc82c *R/h5.R 56ddd7a01d957f768e214bf3ff7d1286 *R/inherit_default_params.R -10578fb8a2f46f5ecb3b982175fa2b2f *R/install_packages.R +54d7dba8e284ec639517ca1e31b66a83 *R/install_packages.R ad9da1318face1a62868506526ccb6b2 *R/mapdf.R 1b5098c5f0d238d3fc738e27f0cae80e *R/news.R 6af355edbc57f40b9a0c7d146f1d04fb *R/package.R @@ -22,29 +23,29 @@ ad9da1318face1a62868506526ccb6b2 *R/mapdf.R 3a163b578e254a622a259fb15598b87a *R/sparse_matrix.R ed5a6e94e1159f1aafdcfc1c82c27d49 *R/spearman_rank_sparse.R 508280137e6c0eb4d37a5872de6ab486 *R/tibble.R -48d895501ba6e7aee8abb5ab2798b933 *README.md -17cf65be3e139c69126d46bd2eb705a4 *build/vignette.rds -9b2832b80e7882c4d2ac183a85a9c734 *inst/doc/functionality.R +397be7eff15f739c62736951d139e41b *README.md +b2421696f8a91492d12c349d4277a765 *build/vignette.rds +a60b55d68196751eae1016f1871240de *inst/doc/functionality.R fd437c3c797311ac07d31ffd0e74d86c *inst/doc/functionality.Rmd -4c5894500d88dbf2fcae4edd14fb0cde *inst/doc/functionality.html +7229fbbf14fc22687c8319a98cbb003b *inst/doc/functionality.html c3db2b03d9fad3aa6837b3f565dfdebd *man/add_class.Rd 6bc340f4659bf12f836063f6dbdd2329 *man/all_in.Rd b5ac523861808607b014847cb3797765 *man/apply_minmax_scale.Rd 64174b3e65b65ce84ce3293ae492f994 *man/apply_quantile_scale.Rd 3bef0a231eef2816e0a263a1e4a2242c *man/apply_uniform_scale.Rd -2a41ba64ac7e6974373c798d81c51322 *man/calculate_distance.Rd +9e9d83fa65d3435bb9e808709fc6ccd6 *man/calculate_distance.Rd 5b35a6f332946299b91d087180993a29 *man/calculate_mean.Rd 3252699f0111548d1c5865b259fc6045 *man/check_packages.Rd 8119f54576526e375c65967172a35730 *man/deprecated.Rd -7af19552f7245eb474ebb2d702a532a4 *man/dynutils.Rd +e2ceb10024be583a126677b4de494f0a *man/dynutils.Rd 7709555d2461d3fdc0754ff9ed78c279 *man/expand_matrix.Rd 3018e1eb12824f76075b195fe12a4916 *man/extend_with.Rd 7613b5995b078d708cc26c1a5d2d9b88 *man/extract_row_to_list.Rd b13a5533db06c4565c8025ec07416d90 *man/figures/dependencies.png 21c38d6edb23eb7766127edfb805d2cc *man/has_names.Rd e7578523a6fa518bfb8ed4c7def2a0ea *man/inherit_default_params.Rd -7882b49fc121c84cc4ce635266e3392f *man/install_packages.Rd -ffb5cc4ea8eb2cc74b8881ee03793acc *man/is_bounded.Rd +a351ae26cd8158546f000ba27b14404a *man/install_packages.Rd +b5e279e1ffba1a1a8a1ac1c0d43b58c6 *man/is_bounded.Rd b9518d93e55a498b29be70221d67e209 *man/is_single_numeric.Rd 9c390e87ca76ed1d225baea185e4b038 *man/is_sparse.Rd c75c1e1f49dbefd8590f7424587ad69b *man/list_as_tibble.Rd @@ -52,7 +53,7 @@ accf4b9c8028a260b70a2e76e0c5cc04 *man/mapdf.Rd 2b3a023bd618893c84f8145c2396ae97 *man/project_to_segments.Rd 2cf7693dbaf3302c64209d7336c447d5 *man/random_time_string.Rd 924b15280c2637b60a75a439b96da664 *man/read_h5.Rd -b0cb95b27f4369b40ec09cdb98029c5d *man/recent_news.Rd +ade76e3a41972c1df16527a5d29becb1 *man/recent_news.Rd 4709d575d5fa06a874efac612a29ee78 *man/safe_tempdir.Rd 3ebf0627b766e627129d9ea56bc4e725 *man/scale_minmax.Rd 796b56abcd3919f503ddecb80735ea9a *man/scale_quantile.Rd @@ -73,7 +74,6 @@ dbb99d66a04da64c942eeb3d2aad76a4 *tests/testthat/test-check_packages.R 8faa7d5a28c69f65e45e8ff451fc705b *tests/testthat/test-extend_with.R 6b476ee9c8230218a976b0abc9457fbf *tests/testthat/test-h5.R 5ce31da95e0ab2cae64f31550e6957c1 *tests/testthat/test-inherit_default_params.R -f665360485a47a68db1c5e78f4419139 *tests/testthat/test-install_packages.R eb500b1fea1726787b4e1cc25de6caa0 *tests/testthat/test-mapdf.R 87086196556352c60f0e8a21d5e13e02 *tests/testthat/test-news.R 12b22a50c13f031e04cafada2045e5eb *tests/testthat/test-project_to_segments.R diff --git a/NEWS.md b/NEWS.md index f029f07..7b8bbc8 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,10 @@ -# dynutils 1.0.4 +# dynutils 1.0.5 + + * BUG FIX `install_packages()`: will not try to install packages when the session is not interactive. + + * LICENSE: Change to MIT. + +# dynutils 1.0.4 (2019-10-03) * BUG FIX `recent_news()`: do not prepend subsections. diff --git a/R/check_packages.R b/R/check_packages.R index c772b19..dd3cac7 100644 --- a/R/check_packages.R +++ b/R/check_packages.R @@ -11,6 +11,6 @@ #' check_packages(c("princurve", "mlr", "tidyverse")) check_packages <- function(...) { packages <- unlist(list(...)) - installed_packages <- rownames(utils::installed.packages()) - set_names(packages %in% installed_packages, packages) + installed_packages <- map_lgl(packages, requireNamespace, quietly = TRUE) + set_names(installed_packages, packages) } diff --git a/R/install_packages.R b/R/install_packages.R index 91b26b4..589702d 100644 --- a/R/install_packages.R +++ b/R/install_packages.R @@ -4,10 +4,12 @@ parse_remotes <- function(remotes) { set_names(remotes) } -#' Install packages, but first ask if interactive +#' Check package availability #' -#' @param ... The names of the packages to be installed -#' @param is_interactive Whether running interactivly, which will prompt the user before installation +#' If the session is interactive, prompt the user whether to install the packages. +#' +#' @param ... The names of the packages to be checked +#' @param try_install Whether running interactivly, which will prompt the user before installation #' #' @importFrom remotes install_cran #' @importFrom utils setRepositories @@ -18,11 +20,11 @@ parse_remotes <- function(remotes) { #' \dontrun{ #' install_packages("SCORPIUS") #' } -install_packages <- function(..., is_interactive = interactive()) { +install_packages <- function(..., try_install = interactive()) { dependencies <- unlist(list(...)) %>% discard(check_packages) if (length(dependencies) > 0) { - if (is_interactive) { + if (try_install) { message(paste0( "Following packages have to be installed: ", paste(crayon::bold(dependencies), collapse = ", "), @@ -40,6 +42,11 @@ install_packages <- function(..., is_interactive = interactive()) { if (answer %in% c("no", "n", "2")) { stop("Installation was interrupted.") } + } else { + stop( + "Please install the following packages: \n", + " ", paste0("\"", dependencies, "\"", collapse = ",") + ) } # set repositories to include bioconductor @@ -48,7 +55,7 @@ install_packages <- function(..., is_interactive = interactive()) { message("Installing ", paste0(dependencies, collapse = ", ")) # install other depencies from cran - remotes::install_cran(dependencies, repos = "http://cran.rstudio.com") + remotes::install_cran(dependencies) # display message message("Installed ", paste0(dependencies, collapse = ", ")) @@ -56,6 +63,6 @@ install_packages <- function(..., is_interactive = interactive()) { # return installed dependencies at the end dependencies } else { - NULL + invisible(NULL) } } diff --git a/README.md b/README.md index a3d4daf..8fecc88 100644 --- a/README.md +++ b/README.md @@ -26,27 +26,22 @@ changes. -### Recent changes in dynutils 1.0.4 +### Recent changes in dynutils 1.0.5 - - BUG FIX `recent_news()`: do not prepend subsections. - - - BUG FIX `switch_cran()`: add missing version variable. - - - REMOVAL `update_news()` remove this function as R 3.6 natively - supports markdown news format. + - BUG FIX `install_packages()`: will not try to install packages when + the session is not interactive. -### Recent changes in dynutils 1.0.3 (2019-05-02) + - LICENSE: Change to MIT. - - FUNCTIONALITY: Added `test_h5_installation()`. +### Recent changes in dynutils 1.0.4 (2019-10-03) - - BUG FIX: Added compatibility workaround for being able to read hdf5 - 1.10.4 files on a hdf5 1.8.14 Windows platform (hhoeflin/hdf5r\#60). + - BUG FIX `recent_news()`: do not prepend subsections. - - FUNCTIONALITY: `calculate_distance()` and `calculate_similarity()` - now support sparse matrix calculation thanks to proxyC\! + - BUG FIX `switch_cran()`: add missing version variable. - - SMALL CHANGES: Remove dependencies: glue, Hmisc, devtools, testthat, - tidyr. + - REMOVAL `update_news()` remove this function as R 3.6 natively + supports markdown news +format. ## Dynverse dependencies diff --git a/build/vignette.rds b/build/vignette.rds index f3b680b..b57b48b 100644 Binary files a/build/vignette.rds and b/build/vignette.rds differ diff --git a/inst/doc/functionality.R b/inst/doc/functionality.R index 1c347f3..02adb71 100644 --- a/inst/doc/functionality.R +++ b/inst/doc/functionality.R @@ -1,4 +1,4 @@ -## ----setup1, echo=FALSE, message=FALSE----------------------------------- +## ----setup1, echo=FALSE, message=FALSE---------------------------------------- knitr::opts_chunk$set(comment = "#>", collapse = TRUE) library(dplyr) library(readr) @@ -8,7 +8,7 @@ library(ggplot2) library(dynutils) set.seed(1) -## ----echo=FALSE, results='asis'------------------------------------------ +## ----echo=FALSE, results='asis'----------------------------------------------- lines <- read_lines("functionality.Rmd") headings <- c(which(grepl("^## ", lines)), length(lines)) subheadings <- which(grepl("^### .*`", lines)) @@ -36,25 +36,25 @@ strs <- map_chr(seq_len(length(headings) - 1), function(i) { }) cat(strs, sep = "") -## ----add_class----------------------------------------------------------- +## ----add_class---------------------------------------------------------------- l <- list(important_number = 42) %>% add_class("my_list") l -## ----extend_with--------------------------------------------------------- +## ----extend_with-------------------------------------------------------------- l %>% extend_with( .class_name = "improved_list", url = "https://github.com/dynverse/dynverse" ) -## ----calculate_distance-------------------------------------------------- +## ----calculate_distance------------------------------------------------------- x <- matrix(runif(30), ncol = 10) y <- matrix(runif(50), ncol = 10) calculate_distance(x, y, method = "euclidean") -## ----dist---------------------------------------------------------------- +## ----dist--------------------------------------------------------------------- as.matrix(dist(rbind(x, y)))[1:3, -1:-3] -## ----project_to_segments------------------------------------------------- +## ----project_to_segments------------------------------------------------------ x <- matrix(rnorm(50, 0, .5), ncol = 2) segfrom <- matrix(c(0, 1, 0, -1, 1, 0, -1, 0), ncol = 2, byrow = TRUE) segto <- segfrom / 10 @@ -72,7 +72,7 @@ ggplot() + str(fit) -## ----calculate_mean------------------------------------------------------ +## ----calculate_mean----------------------------------------------------------- calculate_arithmetic_mean(0.1, 0.5, 0.9) calculate_geometric_mean(0.1, 0.5, 0.9) calculate_harmonic_mean(0.1, 0.5, 0.9) @@ -88,36 +88,36 @@ calculate_geometric_mean(vectors) # example of weighted means calculate_geometric_mean(c(0.1, 10), c(0.9, 20), c(0.5, 2), weights = c(1, 2, 5)) -## ----expand_matrix------------------------------------------------------- +## ----expand_matrix------------------------------------------------------------ x <- matrix(runif(12), ncol = 4, dimnames = list(c("a", "c", "d"), c("D", "F", "H", "I"))) expand_matrix(x, letters[1:5], LETTERS[1:10], fill = 0) -## ----scale_uniform_gen--------------------------------------------------- +## ----scale_uniform_gen-------------------------------------------------------- x <- matrix(rnorm(200*2, sd = 10, mean = 5), ncol = 2) -## ----scale_uniform------------------------------------------------------- +## ----scale_uniform------------------------------------------------------------ x_scaled <- scale_uniform(x, center = 0, max_range = 1) -## ----scale_uniform_verify------------------------------------------------ +## ----scale_uniform_verify----------------------------------------------------- ranges <- apply(x_scaled, 2, range) ranges # should all lie between -.5 and .5 colMeans(ranges) # should all be equal to 0 apply(ranges, 2, diff) # max should be 1 -## ----scale_minmax-------------------------------------------------------- +## ----scale_minmax------------------------------------------------------------- x_scaled2 <- scale_minmax(x) -## ----scale_minmax_verify------------------------------------------------- +## ----scale_minmax_verify------------------------------------------------------ apply(x_scaled2, 2, range) # each column should be [0, 1] -## ----scale_quantile------------------------------------------------------ +## ----scale_quantile----------------------------------------------------------- x_scaled3 <- scale_quantile(x, .05) -## ----scale_quantile_verify----------------------------------------------- +## ----scale_quantile_verify---------------------------------------------------- apply(x_scaled3, 2, range) # each column should be [0, 1] qplot(x_scaled2[,1], x_scaled3[,1]) + theme_bw() -## ----inherit_default_params---------------------------------------------- +## ----inherit_default_params--------------------------------------------------- fun1 <- function(a = 10, b = 7) runif(a, -b, b) fun2 <- function(c = 9) 2^c @@ -130,21 +130,21 @@ fun3 <- inherit_default_params( fun3 -## ----check_packages------------------------------------------------------ +## ----check_packages----------------------------------------------------------- check_packages("SCORPIUS", "dynutils", "wubbalubbadubdub") check_packages(c("princurve", "mlr", "tidyverse")) -## ----install_packages, eval = FALSE-------------------------------------- +## ----install_packages, eval = FALSE------------------------------------------- # install_packages("SCORPIUS", package = "dynmethods", prompt = TRUE) -## ----random_time_string-------------------------------------------------- +## ----random_time_string------------------------------------------------------- random_time_string("test") random_time_string("test") random_time_string("test") -## ----list_as_tibble------------------------------------------------------ +## ----list_as_tibble----------------------------------------------------------- li <- list( list(a = 1, b = log10, c = "parrot") %>% add_class("myobject"), list(a = 2, b = sqrt, c = "quest") %>% add_class("yourobject") @@ -154,45 +154,45 @@ tib <- list_as_tibble(li) tib -## ----tibble_as_list------------------------------------------------------ +## ----tibble_as_list----------------------------------------------------------- li <- tibble_as_list(tib) li -## ----extract_row_to_list------------------------------------------------- +## ----extract_row_to_list------------------------------------------------------ extract_row_to_list(tib, 2) -## ----mapdf_function------------------------------------------------------ +## ----mapdf_function----------------------------------------------------------- tib %>% mapdf(class) -## ----mapdf_anonfun------------------------------------------------------- +## ----mapdf_anonfun------------------------------------------------------------ tib %>% mapdf(function(row) paste0(row$b(row$a), "_", row$c)) -## ----mapdf_formula------------------------------------------------------- +## ----mapdf_formula------------------------------------------------------------ tib %>% mapdf(~ .$b) -## ----mapdf_more---------------------------------------------------------- +## ----mapdf_more--------------------------------------------------------------- tib %>% mapdf_lgl(~ .$a > 1) tib %>% mapdf_chr(~ paste0("~", .$c, "~")) tib %>% mapdf_int(~ nchar(.$c)) tib %>% mapdf_dbl(~ .$a * 1.234) -## ----safe_tempdir-------------------------------------------------------- +## ----safe_tempdir------------------------------------------------------------- safe_tempdir("samson") -## ----all_in, error=TRUE-------------------------------------------------- +## ----all_in, error=TRUE------------------------------------------------------- library(assertthat) assert_that(c(1, 2) %all_in% c(0, 1, 2, 3, 4)) assert_that("a" %all_in% letters) assert_that("A" %all_in% letters) assert_that(1:10 %all_in% letters) -## ----hasnames, error=TRUE------------------------------------------------ +## ----hasnames, error=TRUE----------------------------------------------------- assert_that(li %has_names% "a") assert_that(li %has_names% "c") assert_that(li %has_names% letters) -## ----is_single_numeric, error=TRUE--------------------------------------- +## ----is_single_numeric, error=TRUE-------------------------------------------- assert_that(is_single_numeric(1)) assert_that(is_single_numeric(Inf)) assert_that(is_single_numeric(1.6)) @@ -200,7 +200,7 @@ assert_that(is_single_numeric(NA)) assert_that(is_single_numeric(1:6)) assert_that(is_single_numeric("pie")) -## ----is_bounded, error=TRUE---------------------------------------------- +## ----is_bounded, error=TRUE--------------------------------------------------- assert_that(is_bounded(10)) assert_that(is_bounded(10:30)) assert_that(is_bounded(Inf)) diff --git a/inst/doc/functionality.html b/inst/doc/functionality.html index d190705..194cd79 100644 --- a/inst/doc/functionality.html +++ b/inst/doc/functionality.html @@ -1,15 +1,14 @@ - + - - + @@ -118,9 +117,6 @@ font-size: 14px; line-height: 1.35; } -#header { -text-align: center; -} #TOC { clear: both; margin: 0 0 10px 10px; @@ -288,7 +284,8 @@ code > span.co { color: #888888; font-style: italic; } code > span.ot { color: #007020; } code > span.al { color: #ff0000; font-weight: bold; } -code > span.fu { color: #900; font-weight: bold; } code > span.er { color: #a61717; background-color: #e3d2d2; } +code > span.fu { color: #900; font-weight: bold; } +code > span.er { color: #a61717; background-color: #e3d2d2; } @@ -527,13 +524,13 @@

Manipulation of vectors

@@ -639,7 +636,7 @@

File helpers

diff --git a/man/calculate_distance.Rd b/man/calculate_distance.Rd index 5671d4a..857f02b 100644 --- a/man/calculate_distance.Rd +++ b/man/calculate_distance.Rd @@ -7,13 +7,21 @@ \alias{list_similarity_methods} \title{Calculate (column-wise) distances/similarity between two matrices} \usage{ -calculate_distance(x, y = NULL, method = c("pearson", "spearman", - "cosine", "euclidean", "manhattan"), margin = 1) +calculate_distance( + x, + y = NULL, + method = c("pearson", "spearman", "cosine", "euclidean", "manhattan"), + margin = 1 +) list_distance_methods() -calculate_similarity(x, y = NULL, margin = 1, method = c("spearman", - "pearson", "cosine")) +calculate_similarity( + x, + y = NULL, + margin = 1, + method = c("spearman", "pearson", "cosine") +) list_similarity_methods() } diff --git a/man/dynutils.Rd b/man/dynutils.Rd index 1de3c45..902e907 100644 --- a/man/dynutils.Rd +++ b/man/dynutils.Rd @@ -3,7 +3,6 @@ \docType{package} \name{dynutils} \alias{dynutils} -\alias{dynutils-package} \title{Common functionality for the dynverse packages} \description{ Provides common functionality for the dynverse packages. diff --git a/man/install_packages.Rd b/man/install_packages.Rd index 7948750..d7ff3d4 100644 --- a/man/install_packages.Rd +++ b/man/install_packages.Rd @@ -2,17 +2,17 @@ % Please edit documentation in R/install_packages.R \name{install_packages} \alias{install_packages} -\title{Install packages, but first ask if interactive} +\title{Check package availability} \usage{ -install_packages(..., is_interactive = interactive()) +install_packages(..., try_install = interactive()) } \arguments{ -\item{...}{The names of the packages to be installed} +\item{...}{The names of the packages to be checked} -\item{is_interactive}{Whether running interactivly, which will prompt the user before installation} +\item{try_install}{Whether running interactivly, which will prompt the user before installation} } \description{ -Install packages, but first ask if interactive +If the session is interactive, prompt the user whether to install the packages. } \examples{ \dontrun{ diff --git a/man/is_bounded.Rd b/man/is_bounded.Rd index acdb247..8a00cab 100644 --- a/man/is_bounded.Rd +++ b/man/is_bounded.Rd @@ -4,8 +4,13 @@ \alias{is_bounded} \title{Check whether a value within a certain interval} \usage{ -is_bounded(x, lower_bound = -Inf, lower_closed = FALSE, - upper_bound = Inf, upper_closed = FALSE) +is_bounded( + x, + lower_bound = -Inf, + lower_closed = FALSE, + upper_bound = Inf, + upper_closed = FALSE +) } \arguments{ \item{x}{A value to be tested} diff --git a/man/recent_news.Rd b/man/recent_news.Rd index 19c8bdf..259bc6b 100644 --- a/man/recent_news.Rd +++ b/man/recent_news.Rd @@ -4,8 +4,7 @@ \alias{recent_news} \title{Print the most recent news} \usage{ -recent_news(path = NULL, package = detect_package_name(path = path), - n = 2) +recent_news(path = NULL, package = detect_package_name(path = path), n = 2) } \arguments{ \item{path}{The path of the description in which the package resides} diff --git a/tests/testthat/test-install_packages.R b/tests/testthat/test-install_packages.R deleted file mode 100644 index bf5e781..0000000 --- a/tests/testthat/test-install_packages.R +++ /dev/null @@ -1,47 +0,0 @@ -context("Testing install_packages") - -r <- getOption("repos") -r["CRAN"] <- "http://cran.r-project.org" -options(repos = r) - -skip_on_cran() - -test_that("no messages are printed when packages are already installed", { - expect_message(out <- install_packages(c("dynutils", "dplyr")), NA) - expect_null(out) -}) - -test_that("no messages are printed when packages are already installed, given a depending package", { - expect_message(out <- install_packages("dplyr", package = "dynutils"), NA) - expect_null(out) -}) - -test_that("dependencies can be installed", { - is_present <- check_packages("whoami") - if (is_present) remove.packages("whoami") - out <- install_packages("whoami", is_interactive = FALSE) - if (!is_present) remove.packages("whoami") - expect_equal(out, "whoami") -}) - -test_that("prompt works as expected", { - is_present <- check_packages("princurve") - if (is_present) remove.packages("princurve") - options(dynutils_testmodepromptresponse = 2) - expect_error( - expect_message( - out <- install_packages("princurve", is_interactive = TRUE), - "Following packages have to be installed" - ), - "Installation was interrupted" - ) - - if (check_packages("princurve")) remove.packages("princurve") - options(dynutils_testmodepromptresponse = 1) - expect_message(out <- install_packages("princurve", is_interactive = TRUE), "Following packages have to be installed") - if (is_present) remove.packages("princurve") - expect_equal(out, "princurve") - - options(dynutils_testmodepromptresponse = NULL) -}) -