Skip to content

Commit 54039f9

Browse files
committed
diminishing returns...
1 parent 9080fbb commit 54039f9

File tree

3 files changed

+29
-18
lines changed

3 files changed

+29
-18
lines changed

tests/testthat/test_gg_minimal_depth.R

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ test_that("gg_minimal_depth classifications",{
1616
expect_false(is.null(varsel_iris$md.obj))
1717

1818
## Create the correct gg_error object
19-
ggrf.obj<- gg_minimal_depth(varsel_iris)
19+
gg_dta<- gg_minimal_depth(varsel_iris)
2020

2121
# Test object type
22-
expect_is(ggrf.obj, "gg_minimal_depth")
22+
expect_is(gg_dta, "gg_minimal_depth")
2323

2424
# Test varselect is the same
25-
expect_equivalent(ggrf.obj$varselect[,-which(colnames(ggrf.obj$varselect)=="names")],
25+
expect_equivalent(gg_dta$varselect[,-which(colnames(gg_dta$varselect)=="names")],
2626
varsel_iris$varselect)
2727

2828
## Test plotting the gg_error object
29-
gg.obj <- plot.gg_minimal_depth(ggrf.obj)
29+
gg.obj <- plot.gg_minimal_depth(gg_dta)
3030

3131
# Test return is s ggplot object
3232
expect_is(gg.obj, "ggplot")
@@ -46,17 +46,17 @@ test_that("gg_minimal_depth survival",{
4646
expect_is(varsel_veteran, "list")
4747

4848
## Create the correct gg_error object
49-
ggrf.obj<- gg_minimal_depth(varsel_veteran)
49+
gg_dta<- gg_minimal_depth(varsel_veteran)
5050

5151
# Test object type
52-
expect_is(ggrf.obj, "gg_minimal_depth")
52+
expect_is(gg_dta, "gg_minimal_depth")
5353

5454
# Test varselect is the same
55-
expect_equivalent(ggrf.obj$varselect[, -which(colnames(ggrf.obj$varselect)=="names")],
55+
expect_equivalent(gg_dta$varselect[, -which(colnames(gg_dta$varselect)=="names")],
5656
varsel_veteran$varselect)
5757

5858
## Test plotting the gg_error object
59-
gg.obj <- plot.gg_minimal_depth(ggrf.obj)
59+
gg.obj <- plot.gg_minimal_depth(gg_dta)
6060

6161
# Test return is s ggplot object
6262
expect_is(gg.obj, "ggplot")
@@ -75,17 +75,17 @@ test_that("gg_minimal_depth regression",{
7575
expect_is(varsel_airq, "list")
7676

7777
## Create the correct gg_error object
78-
ggrf.obj<- gg_minimal_depth(varsel_airq)
78+
gg_dta<- gg_minimal_depth(varsel_airq)
7979

8080
# Test object type
81-
expect_is(ggrf.obj, "gg_minimal_depth")
81+
expect_is(gg_dta, "gg_minimal_depth")
8282

8383
# Test varselect is the same
84-
expect_equivalent(ggrf.obj$varselect[, -which(colnames(ggrf.obj$varselect)=="names")],
84+
expect_equivalent(gg_dta$varselect[, -which(colnames(gg_dta$varselect)=="names")],
8585
varsel_airq$varselect)
8686

8787
## Test plotting the gg_error object
88-
gg.obj <- plot.gg_minimal_depth(ggrf.obj)
88+
gg.obj <- plot.gg_minimal_depth(gg_dta)
8989

9090
# Test return is s ggplot object
9191
expect_is(gg.obj, "ggplot")
@@ -97,9 +97,9 @@ test_that("gg_minimal_depth regression",{
9797
expect_is(varsel_Boston, "list")
9898

9999
## Create the correct gg_error object
100-
ggrf.obj<- gg_minimal_depth(varsel_Boston)
100+
gg_dta<- gg_minimal_depth(varsel_Boston)
101101
# Test object type
102-
expect_is(ggrf.obj, "gg_minimal_depth")
102+
expect_is(gg_dta, "gg_minimal_depth")
103103

104104
data(Boston, package="MASS")
105105

@@ -143,7 +143,7 @@ test_that("gg_minimal_depth regression",{
143143
names(st.labs) <- names(cls)
144144

145145
## Test plotting the gg_error object
146-
gg.obj <- plot.gg_minimal_depth(ggrf.obj, lbls=st.labs, selection=TRUE)
146+
gg.obj <- plot.gg_minimal_depth(gg_dta, lbls=st.labs, selection=TRUE)
147147

148148
# Test return is s ggplot object
149149
expect_is(gg.obj, "ggplot")
@@ -180,7 +180,8 @@ test_that("gg_minimal_depth exceptions",{
180180
"minimal depth variable selection")
181181
expect_is(gg_dta, "gg_minimal_depth")
182182

183-
expect_output(gg_dta <- plot.gg_minimal_depth(rfsrc_airq, fast=TRUE),
183+
expect_output(gg_plt <- plot.gg_minimal_depth(rfsrc_airq, fast=TRUE),
184184
"minimal depth variable selection")
185+
expect_error(gg_minimal_depth(gg_plt))
185186

186187
})

tests/testthat/test_gg_minimal_vimp.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,4 +164,7 @@ test_that("gg_minimal_vimp exceptions",{
164164
expect_output(gg_dta <- gg_minimal_vimp(rfsrc_airq, fast=TRUE),
165165
"minimal depth variable selection")
166166
expect_is(gg_dta, "gg_minimal_vimp")
167-
})
167+
gg_plt <- plot.gg_minimal_vimp(gg_dta)
168+
expect_error(gg_minimal_depth(gg_plt))
169+
170+
})

tests/testthat/test_gg_vimp.R

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ test_that("gg_vimp survival",{
6565
expect_is(rfsrc_pbc, "rfsrc")
6666

6767
## Create the correct gg_error object
68-
expect_is(gg_dta<- gg_vimp(rfsrc_pbc),
68+
expect_is(gg_dta<- gg_vimp(rfsrc_pbc, relative=TRUE),
6969
"gg_vimp")
7070
expect_is(plot(gg_dta), "ggplot")
7171

@@ -95,6 +95,11 @@ test_that("gg_vimp regression",{
9595
## Test plotting the gg_error object
9696
gg_plt <- plot.gg_vimp(gg_dta)
9797

98+
# Test return is s ggplot object
99+
expect_is(gg_plt, "ggplot")
100+
## Test plotting the gg_error object
101+
gg_plt <- plot.gg_vimp(gg_dta, relative=TRUE)
102+
98103
# Test return is s ggplot object
99104
expect_is(gg_plt, "ggplot")
100105

@@ -144,4 +149,6 @@ test_that("gg_vimp regression",{
144149
gg_plt <- plot.gg_vimp(rfsrc_Boston, lbls=st.labs, relative=TRUE,
145150
bars=rfsrc_Boston$xvar.names)
146151
expect_is(gg_plt, "ggplot")
152+
153+
147154
})

0 commit comments

Comments
 (0)