Skip to content

Commit d6653ed

Browse files
committed
test.data.table try to load only available pkgs, closes #1193
1 parent 9362c4d commit d6653ed

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@
6363

6464
14. `fread` with `stringsAsFactors = TRUE` no longer produces factors with NA as a factor level, [#1408](https://github.com/Rdatatable/data.table/pull/1408). Thanks to @DexGroves.
6565

66+
15. `test.data.table` no longer raise warning if suggested packages are not available. Thanks to @jangorecki for PR [#1403](https://github.com/Rdatatable/data.table/pull/1403), closes [#1193](https://github.com/Rdatatable/data.table/issues/1193).
67+
6668
#### NOTES
6769

6870
1. Updated error message on invalid joins to reflect the new `on=` syntax, [#1368](https://github.com/Rdatatable/data.table/issues/1368). Thanks @MichaelChirico.

inst/tests/tests.Rraw

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,14 @@
55
if (!exists("test.data.table",.GlobalEnv,inherits=FALSE)) {
66
require(data.table) # in dev the package should not be loaded
77
options(warn=0) # use require() so it warns but doesn't halt if not available
8-
require(plyr)
9-
require(ggplot2)
10-
require(hexbin)
11-
require(nlme)
12-
require(xts)
13-
require(bit64)
14-
require(gdata)
15-
require(GenomicRanges)
16-
require(caret)
17-
require(knitr)
18-
require(plm)
8+
inst_pkgs = rownames(installed.packages())
9+
sugg_pkgs = c("plyr","ggplot2","hexbin","nlme","xts","bit64","gdata","GenomicRanges","caret","knitr","plm")
10+
lapply(sugg_pkgs, function(pkg) if(pkg %in% inst_pkgs) require(pkg, character.only=TRUE))
1911
# reshape2 ahead of reshape ...
2012
try(detach(package:reshape2),silent=TRUE)
2113
try(detach(package:reshape),silent=TRUE)
22-
library(reshape2, pos="package:base", logical.return=TRUE)
23-
library(reshape, pos="package:base", logical.return=TRUE)
14+
if("reshape2" %in% inst_pkgs) library(reshape2, pos="package:base", logical.return=TRUE)
15+
if("reshape" %in% inst_pkgs) library(reshape, pos="package:base", logical.return=TRUE)
2416
.devtesting=FALSE
2517
} else {
2618
# Matt has suppressMessages(require(bit64)) in .Rprofile

0 commit comments

Comments
 (0)