Skip to content

Commit dad3d62

Browse files
Merge pull request #83 from rsquaredacademy/develop
Develop
2 parents df60eb8 + a13cdbd commit dad3d62

File tree

5 files changed

+57
-9
lines changed

5 files changed

+57
-9
lines changed

.travis.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,17 @@ addons:
1010
packages:
1111
- libnlopt-dev
1212

13-
r:
14-
- 3.3
15-
- 3.4
16-
- release
17-
- devel
18-
13+
matrix:
14+
include:
15+
- r: oldrel
16+
- r: release
17+
- r: release
18+
os: osx
19+
osx_image: xcode7.3
20+
before_install:
21+
- sudo tlmgr install framed titling
22+
- r: devel
23+
1924
r_packages:
2025
- covr
2126

DESCRIPTION

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ Imports:
2929
scales,
3030
stats,
3131
tibble,
32-
utils
32+
utils,
33+
xplorerr
3334
Suggests:
3435
covr,
3536
ineq,

NAMESPACE

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,4 +227,7 @@ importFrom(tibble,as_data_frame)
227227
importFrom(tibble,as_tibble)
228228
importFrom(tibble,tibble)
229229
importFrom(utils,data)
230+
importFrom(utils,install.packages)
231+
importFrom(utils,menu)
232+
importFrom(utils,packageVersion)
230233
useDynLib(blorr, .registration = TRUE)

R/blr-launch-app.R

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,23 @@
77
#' @export
88
#'
99
blr_launch_app <- function() {
10-
rlang::abort("The shiny app has been moved to a new package, `xplorerr`. To launch the app, run the below code:\n
11-
- install.packages('xplorerr')\n - xplorerr::app_logistic_regression()")
10+
11+
rlang::inform("`blr_launch_app()` has been soft-deprecated and will be removed in the next release. In future, to launch the app, run the below code:\n
12+
- install.packages('xplorerr')\n - xplorerr::app_logistic_regression()\n")
13+
14+
check_suggests('descriptr')
15+
check_suggests('jsonlite')
16+
check_suggests('haven')
17+
check_suggests('lubridate')
18+
check_suggests('readr')
19+
check_suggests('readxl')
20+
check_suggests('shinyBS')
21+
check_suggests('shinycssloaders')
22+
check_suggests('shinythemes')
23+
check_suggests('stringr')
24+
check_suggests('tidyr')
25+
26+
xplorerr::app_logistic_regression()
27+
1228
}
1329

R/blr-utils.R

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,3 +281,26 @@ mod_sel_data <- function(model) {
281281
model %>%
282282
use_series(data)
283283
}
284+
285+
#' @importFrom utils packageVersion menu install.packages
286+
check_suggests <- function(pkg) {
287+
288+
pkg_flag <- tryCatch(utils::packageVersion(pkg), error = function(e) NA)
289+
290+
if (is.na(pkg_flag)) {
291+
292+
msg <- message(paste0('\n', pkg, ' must be installed for this functionality.'))
293+
294+
if (interactive()) {
295+
message(msg, "\nWould you like to install it?")
296+
if (utils::menu(c("Yes", "No")) == 1) {
297+
utils::install.packages(pkg)
298+
} else {
299+
stop(msg, call. = FALSE)
300+
}
301+
} else {
302+
stop(msg, call. = FALSE)
303+
}
304+
}
305+
306+
}

0 commit comments

Comments
 (0)