diff --git a/DESCRIPTION b/DESCRIPTION index 6170e610..b75873d4 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: metabolyseR Title: Methods for Pre-Treatment, Data Mining and Correlation Analyses of Metabolomics Data -Version: 0.14.7 +Version: 0.14.8 Authors@R: person("Jasen", "Finch", email = "jsf9@aber.ac.uk", role = c("aut", "cre")) Description: A tool kit for pre-treatment, modelling, feature selection and correlation analyses of metabolomics data. URL: https://jasenfinch.github.io/metabolyseR diff --git a/NEWS.md b/NEWS.md index 92d4f501..793fd853 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,9 @@ +# metabolyseR 0.14.8 + +* An error is now thrown during random forest classification when less than two classes are specified. + +* [`plotSupervisedRF()`](https://jasenfinch.github.io/metabolyseR/reference/plotSupervisedRF.html) now skips plotting if errors are encountered during random forest training. + # metabolyseR 0.14.7 * Single replicate classes now automatically removed by [`plotLDA()`](https://jasenfinch.github.io/metabolyseR/reference/plotLDA.html). diff --git a/R/plotSupervisedRF.R b/R/plotSupervisedRF.R index 62a6e7f3..9d31b357 100644 --- a/R/plotSupervisedRF.R +++ b/R/plotSupervisedRF.R @@ -59,35 +59,39 @@ setMethod('plotSupervisedRF', legendPosition = 'bottom', labelSize = 2){ - rf <- randomForest(x, + rf <- try(randomForest(x, cls = cls, rf = rf, reps = 1, - seed = seed) + seed = seed)) - pl <- plotMDS(rf, - cls = cls, - label = label, - ellipses = ellipses, - title = '', - legendPosition = legendPosition, - labelSize = labelSize) + - labs( - caption = str_c('Margin: ', - rf@results$measures$.estimate[4] %>% - round(3))) - - if (isTRUE(ROC) & rf@type == 'classification') { - pl <- pl + - plotROC(rf,legendPosition = legendPosition) + - plot_annotation( - title = title, - theme = theme(plot.title = element_text(face = 'bold'))) + if (class(rf) != 'try-error') { + pl <- plotMDS(rf, + cls = cls, + label = label, + ellipses = ellipses, + title = '', + legendPosition = legendPosition, + labelSize = labelSize) + + labs( + caption = str_c('Margin: ', + rf@results$measures$.estimate[4] %>% + round(3))) + + if (isTRUE(ROC) & rf@type == 'classification') { + pl <- pl + + plotROC(rf,legendPosition = legendPosition) + + plot_annotation( + title = title, + theme = theme(plot.title = element_text(face = 'bold'))) + } else { + pl <- pl + labs(title = title) + } + + return(pl) } else { - pl <- pl + labs(title = title) + warning('Errors encounted in random forest training, skipping plotting of supervised random forest.',call. = FALSE) } - - return(pl) } ) diff --git a/R/randomForest.R b/R/randomForest.R index 4626abc0..5cc55042 100644 --- a/R/randomForest.R +++ b/R/randomForest.R @@ -460,11 +460,14 @@ classification <- function(x, select(all_of(cls)) %>% deframe()) + cls_list <- clsRem %>% + select(all_of(cls)) %>% + deframe() %>% + str_c('"',.,'"') %>% + str_c(.,collapse = ', ') + warning(str_c('Classes with < 5 replicates removed: ', - str_c(str_c('"',clsRem %>% - select(all_of(cls)) %>% - deframe(), - '"'),collapse = ', ')), + cls_list), call. = FALSE) i <- x %>% @@ -472,6 +475,10 @@ classification <- function(x, select(cls) } + if (length(unique(deframe(i))) < 2) { + stop('Need at least two classes to do classification.',call. = FALSE) + } + if (length(comparisons) > 0) { comp <- comparisons } else { diff --git a/docs/404.html b/docs/404.html index 8e202619..6755b37a 100644 --- a/docs/404.html +++ b/docs/404.html @@ -32,7 +32,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/articles/index.html b/docs/articles/index.html index 580075ba..cca40185 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/articles/metabolyseR.html b/docs/articles/metabolyseR.html index 0ac5d5dd..f3312b42 100644 --- a/docs/articles/metabolyseR.html +++ b/docs/articles/metabolyseR.html @@ -33,7 +33,7 @@ metabolyseR - 0.14.7 + 0.14.8 @@ -85,10 +85,10 @@
## 
-## metabolyseR  v0.14.7 Fri Dec 17 17:56:28 2021
+## metabolyseR v0.14.8 Thu Jan 6 13:52:47 2022
## ________________________________________________________________________________
## Parameters:
 ## pre-treatment
@@ -661,30 +661,30 @@ 

Performing an analysis

+## 
[32mComplete! 
[39m[4.4S]

Note: If a data pre-treatment step is not performed prior to modelling or correlation analysis, the raw data will automatically be used.

The analysis object containing the analysis results can be printed to provide some basic information about the results of the analysis.

 print(analysis)
## 
-## metabolyseR v0.14.7
+## metabolyseR v0.14.8
 ## Analysis:
-##     Fri Dec 17 17:56:28 2021
+##     Thu Jan  6 13:52:47 2022
 ## 
 ##  Raw Data:
 ##      No. samples = 120
 ##      No. features = 200
 ## 
 ##  Pre-treated Data:
-##      Fri Dec 17 17:56:29 2021
+##      Thu Jan  6 13:52:47 2022
 ##      No. samples = 120
 ##      No. features = 48
 ## 
 ##  Modelling:
-##      Fri Dec 17 17:56:32 2021
+##      Thu Jan  6 13:52:51 2022
 ##      Methods: randomForest
@@ -699,7 +699,7 @@

Performing a re-analysis
 analysis <- reAnalyse(analysis,parameters)

## 
-## metabolyseR v0.14.7 Fri Dec 17 17:56:33 2021
+## metabolyseR v0.14.8 Thu Jan  6 13:52:51 2022
 ## ________________________________________________________________________________
 ## Parameters:
 ## correlations
@@ -717,25 +717,25 @@ 

Performing a re-analysis
 print(analysis)
## 
-## metabolyseR v0.14.7
+## metabolyseR v0.14.8
 ## Analysis:
-##     Fri Dec 17 17:56:28 2021
+##     Thu Jan  6 13:52:47 2022
 ## 
 ##  Raw Data:
 ##      No. samples = 120
 ##      No. features = 200
 ## 
 ##  Pre-treated Data:
-##      Fri Dec 17 17:56:29 2021
+##      Thu Jan  6 13:52:47 2022
 ##      No. samples = 120
 ##      No. features = 48
 ## 
 ##  Modelling:
-##      Fri Dec 17 17:56:32 2021
+##      Thu Jan  6 13:52:51 2022
 ##      Methods: randomForest
 ## 
 ##  Correlations:
-##      Fri Dec 17 17:56:33 2021
+##      Thu Jan  6 13:52:51 2022
 ##      No. correlations = 140
diff --git a/docs/articles/modelling.html b/docs/articles/modelling.html index 917f5f6f..08a1a680 100644 --- a/docs/articles/modelling.html +++ b/docs/articles/modelling.html @@ -33,7 +33,7 @@ metabolyseR - 0.14.7 + 0.14.8
@@ -85,10 +85,10 @@

The results for the modelling can be specifically extracted using the following.

 analysisResults(analysis,'modelling')
diff --git a/docs/articles/modelling_files/figure-html/outlier-detect-1.png b/docs/articles/modelling_files/figure-html/outlier-detect-1.png
index c2cfd51f..3e092f53 100644
Binary files a/docs/articles/modelling_files/figure-html/outlier-detect-1.png and b/docs/articles/modelling_files/figure-html/outlier-detect-1.png differ
diff --git a/docs/articles/modelling_files/figure-html/regression-mds-1.png b/docs/articles/modelling_files/figure-html/regression-mds-1.png
index bb6c56bd..5044ab7a 100644
Binary files a/docs/articles/modelling_files/figure-html/regression-mds-1.png and b/docs/articles/modelling_files/figure-html/regression-mds-1.png differ
diff --git a/docs/articles/pre_treatment.html b/docs/articles/pre_treatment.html
index fc7b71a7..54dbf2cf 100644
--- a/docs/articles/pre_treatment.html
+++ b/docs/articles/pre_treatment.html
@@ -33,7 +33,7 @@
       
       
         metabolyseR
-        0.14.7
+        0.14.8
       
     
@@ -85,10 +85,10 @@

The pre-treated data can be extracted from the Analysis object using several methods.

diff --git a/docs/articles/quick_start.html b/docs/articles/quick_start.html index b1d46039..c091c1e0 100644 --- a/docs/articles/quick_start.html +++ b/docs/articles/quick_start.html @@ -33,7 +33,7 @@ metabolyseR - 0.14.7 + 0.14.8
@@ -85,10 +85,10 @@
@@ -77,15 +77,15 @@

Citation

-

Finch J (2021). +

Finch J (2022). metabolyseR: Methods for Pre-Treatment, Data Mining and Correlation Analyses of Metabolomics Data. -R package version 0.14.7, https://jasenfinch.github.io/metabolyseR. +R package version 0.14.8, https://jasenfinch.github.io/metabolyseR.

@Manual{,
   title = {metabolyseR: Methods for Pre-Treatment, Data Mining and Correlation Analyses of Metabolomics Data},
   author = {Jasen Finch},
-  year = {2021},
-  note = {R package version 0.14.7},
+  year = {2022},
+  note = {R package version 0.14.8},
   url = {https://jasenfinch.github.io/metabolyseR},
 }
diff --git a/docs/index.html b/docs/index.html index f6c248f8..d44c7cad 100644 --- a/docs/index.html +++ b/docs/index.html @@ -33,7 +33,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/news/index.html b/docs/news/index.html index 05861051..ea905a7e 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 @@ -63,6 +63,11 @@

Changelog

Source: NEWS.md +
+ +
diff --git a/docs/reference/AnalysisData-class.html b/docs/reference/AnalysisData-class.html index 8ba630b1..f1f4e875 100644 --- a/docs/reference/AnalysisData-class.html +++ b/docs/reference/AnalysisData-class.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/AnalysisParameters-class.html b/docs/reference/AnalysisParameters-class.html index f29fed68..9c8e0e79 100644 --- a/docs/reference/AnalysisParameters-class.html +++ b/docs/reference/AnalysisParameters-class.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/QC.html b/docs/reference/QC.html index 581ee1d3..3cd150ff 100644 --- a/docs/reference/QC.html +++ b/docs/reference/QC.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/RandomForest-class.html b/docs/reference/RandomForest-class.html index d0ae9276..50b746fe 100644 --- a/docs/reference/RandomForest-class.html +++ b/docs/reference/RandomForest-class.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/Univariate-class.html b/docs/reference/Univariate-class.html index 0d63c4a0..954dd9e9 100644 --- a/docs/reference/Univariate-class.html +++ b/docs/reference/Univariate-class.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/aggregate.html b/docs/reference/aggregate.html index 3ffa2159..621882ae 100644 --- a/docs/reference/aggregate.html +++ b/docs/reference/aggregate.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/analysis-accessors.html b/docs/reference/analysis-accessors.html index 94353752..4ef2043d 100644 --- a/docs/reference/analysis-accessors.html +++ b/docs/reference/analysis-accessors.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/analysisData.html b/docs/reference/analysisData.html index 9da42eb9..480aea6b 100644 --- a/docs/reference/analysisData.html +++ b/docs/reference/analysisData.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/analysisElements.html b/docs/reference/analysisElements.html index a61039ed..3942fc48 100644 --- a/docs/reference/analysisElements.html +++ b/docs/reference/analysisElements.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/analysisParameters.html b/docs/reference/analysisParameters.html index 6c5bdec7..ad7d97c7 100644 --- a/docs/reference/analysisParameters.html +++ b/docs/reference/analysisParameters.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/anova.html b/docs/reference/anova.html index 8e6ea814..b7151125 100644 --- a/docs/reference/anova.html +++ b/docs/reference/anova.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/bind.html b/docs/reference/bind.html index da7ea650..90354215 100644 --- a/docs/reference/bind.html +++ b/docs/reference/bind.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/changeParameter.html b/docs/reference/changeParameter.html index 27ad36e5..cf3b2a1a 100644 --- a/docs/reference/changeParameter.html +++ b/docs/reference/changeParameter.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/cls.html b/docs/reference/cls.html index b7f0d4cb..05ee9d49 100644 --- a/docs/reference/cls.html +++ b/docs/reference/cls.html @@ -19,7 +19,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/correction-1.png b/docs/reference/correction-1.png index 2fa75dcc..122d4779 100644 Binary files a/docs/reference/correction-1.png and b/docs/reference/correction-1.png differ diff --git a/docs/reference/correction-2.png b/docs/reference/correction-2.png index ac5789e2..040368d2 100644 Binary files a/docs/reference/correction-2.png and b/docs/reference/correction-2.png differ diff --git a/docs/reference/correction.html b/docs/reference/correction.html index 8446427f..70cfdb6f 100644 --- a/docs/reference/correction.html +++ b/docs/reference/correction.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/correlations.html b/docs/reference/correlations.html index 956b823f..c9af15df 100644 --- a/docs/reference/correlations.html +++ b/docs/reference/correlations.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/correlationsParameters.html b/docs/reference/correlationsParameters.html index 8e6077fc..ff0d580a 100644 --- a/docs/reference/correlationsParameters.html +++ b/docs/reference/correlationsParameters.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/impute.html b/docs/reference/impute.html index 04509b29..bb9eca51 100644 --- a/docs/reference/impute.html +++ b/docs/reference/impute.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/index.html b/docs/reference/index.html index 5898e7da..7638e125 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/io-parameters.html b/docs/reference/io-parameters.html index 87af50f8..8515613e 100644 --- a/docs/reference/io-parameters.html +++ b/docs/reference/io-parameters.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/keep.html b/docs/reference/keep.html index 6b886cca..92d934e4 100644 --- a/docs/reference/keep.html +++ b/docs/reference/keep.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/linearRegression.html b/docs/reference/linearRegression.html index 5ee96f09..78be6689 100644 --- a/docs/reference/linearRegression.html +++ b/docs/reference/linearRegression.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/metabolyse.html b/docs/reference/metabolyse.html index d007df47..c25d1d61 100644 --- a/docs/reference/metabolyse.html +++ b/docs/reference/metabolyse.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 @@ -127,7 +127,7 @@

Examples

abr1$fact, p) #> -#> metabolyseR v0.14.7 Fri Dec 17 17:55:29 2021 +#> metabolyseR v0.14.8 Thu Jan 6 13:51:47 2022 #> ________________________________________________________________________________ #> Parameters: #> pre-treatment @@ -146,18 +146,18 @@

Examples

#> returnModels = FALSE #> ________________________________________________________________________________ #> Pre-treatment -#> Pre-treatment [0.8S] +#> Pre-treatment [0.9S] #> Modelling #> Modelling [0.6S] #> ________________________________________________________________________________ #> -#> Complete! [1.4S] +#> Complete! [1.5S] ## Re-analyse to include correlation analysis analysis <- reAnalyse(analysis, parameters = analysisParameters('correlations')) #> -#> metabolyseR v0.14.7 Fri Dec 17 17:55:30 2021 +#> metabolyseR v0.14.8 Thu Jan 6 13:51:48 2022 #> ________________________________________________________________________________ #> Parameters: #> correlations @@ -175,25 +175,25 @@

Examples

print(analysis) #> -#> metabolyseR v0.14.7 +#> metabolyseR v0.14.8 #> Analysis: -#> Fri Dec 17 17:55:29 2021 +#> Thu Jan 6 13:51:47 2022 #> #> Raw Data: #> No. samples = 120 #> No. features = 200 #> #> Pre-treated Data: -#> Fri Dec 17 17:55:30 2021 +#> Thu Jan 6 13:51:48 2022 #> No. samples = 120 #> No. features = 48 #> #> Modelling: -#> Fri Dec 17 17:55:30 2021 +#> Thu Jan 6 13:51:48 2022 #> Methods: anova #> #> Correlations: -#> Fri Dec 17 17:55:30 2021 +#> Thu Jan 6 13:51:48 2022 #> No. correlations = 140
diff --git a/docs/reference/modelling-accessors.html b/docs/reference/modelling-accessors.html index b2f464b6..0a175bfe 100644 --- a/docs/reference/modelling-accessors.html +++ b/docs/reference/modelling-accessors.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/modelling-parameters.html b/docs/reference/modelling-parameters.html index 8a364e9f..5eaab072 100644 --- a/docs/reference/modelling-parameters.html +++ b/docs/reference/modelling-parameters.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/occupancy.html b/docs/reference/occupancy.html index 5785ed4c..65a74c3f 100644 --- a/docs/reference/occupancy.html +++ b/docs/reference/occupancy.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/occupancyFilter.html b/docs/reference/occupancyFilter.html index 56e2316a..91894c10 100644 --- a/docs/reference/occupancyFilter.html +++ b/docs/reference/occupancyFilter.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/parameters.html b/docs/reference/parameters.html index f6db3510..06ebc640 100644 --- a/docs/reference/parameters.html +++ b/docs/reference/parameters.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/plotExplanatoryHeatmap.html b/docs/reference/plotExplanatoryHeatmap.html index 9a09a3d8..f7123220 100644 --- a/docs/reference/plotExplanatoryHeatmap.html +++ b/docs/reference/plotExplanatoryHeatmap.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/plotFeature.html b/docs/reference/plotFeature.html index bdd38e48..085e6ae8 100644 --- a/docs/reference/plotFeature.html +++ b/docs/reference/plotFeature.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/plotImportance.html b/docs/reference/plotImportance.html index 665d0fa5..9d597e65 100644 --- a/docs/reference/plotImportance.html +++ b/docs/reference/plotImportance.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/plotLDA.html b/docs/reference/plotLDA.html index f834c759..fc494726 100644 --- a/docs/reference/plotLDA.html +++ b/docs/reference/plotLDA.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/plotMDS.html b/docs/reference/plotMDS.html index d36ced49..1932f332 100644 --- a/docs/reference/plotMDS.html +++ b/docs/reference/plotMDS.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/plotMetrics.html b/docs/reference/plotMetrics.html index 8b3a2c58..41959b53 100644 --- a/docs/reference/plotMetrics.html +++ b/docs/reference/plotMetrics.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/plotOccupancy.html b/docs/reference/plotOccupancy.html index fe0d5ccc..3791d9b8 100644 --- a/docs/reference/plotOccupancy.html +++ b/docs/reference/plotOccupancy.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/plotPCA.html b/docs/reference/plotPCA.html index 861c4de9..552e506a 100644 --- a/docs/reference/plotPCA.html +++ b/docs/reference/plotPCA.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/plotROC.html b/docs/reference/plotROC.html index f7bebb04..58bca3a3 100644 --- a/docs/reference/plotROC.html +++ b/docs/reference/plotROC.html @@ -18,7 +18,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/plotRSD.html b/docs/reference/plotRSD.html index d972627c..46f20016 100644 --- a/docs/reference/plotRSD.html +++ b/docs/reference/plotRSD.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/plotSupervisedRF.html b/docs/reference/plotSupervisedRF.html index 3b779ed3..0d9fbb76 100644 --- a/docs/reference/plotSupervisedRF.html +++ b/docs/reference/plotSupervisedRF.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/plotTIC.html b/docs/reference/plotTIC.html index f815835d..5d795412 100644 --- a/docs/reference/plotTIC.html +++ b/docs/reference/plotTIC.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/plotUnsupervisedRF.html b/docs/reference/plotUnsupervisedRF.html index 10b7062d..b1fc1db3 100644 --- a/docs/reference/plotUnsupervisedRF.html +++ b/docs/reference/plotUnsupervisedRF.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/pre-treatment-parameters.html b/docs/reference/pre-treatment-parameters.html index e6aae3ff..7e1a6d56 100644 --- a/docs/reference/pre-treatment-parameters.html +++ b/docs/reference/pre-treatment-parameters.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/randomForest.html b/docs/reference/randomForest.html index a3372792..2adf8b24 100644 --- a/docs/reference/randomForest.html +++ b/docs/reference/randomForest.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/reexports.html b/docs/reference/reexports.html index 2680e153..7d05f39f 100644 --- a/docs/reference/reexports.html +++ b/docs/reference/reexports.html @@ -28,7 +28,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/remove.html b/docs/reference/remove.html index 258f1ef4..e75c380d 100644 --- a/docs/reference/remove.html +++ b/docs/reference/remove.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/rsd.html b/docs/reference/rsd.html index 83e3c7f8..23990630 100644 --- a/docs/reference/rsd.html +++ b/docs/reference/rsd.html @@ -18,7 +18,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/split.html b/docs/reference/split.html index 4819d636..574fcae2 100644 --- a/docs/reference/split.html +++ b/docs/reference/split.html @@ -18,7 +18,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/transform.html b/docs/reference/transform.html index e0833dbd..4f090f00 100644 --- a/docs/reference/transform.html +++ b/docs/reference/transform.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/docs/reference/ttest.html b/docs/reference/ttest.html index 12d4b9ee..24450fcc 100644 --- a/docs/reference/ttest.html +++ b/docs/reference/ttest.html @@ -17,7 +17,7 @@ metabolyseR - 0.14.7 + 0.14.8 diff --git a/tests/testthat/test-plotSupervisedRF.R b/tests/testthat/test-plotSupervisedRF.R index 6f7bd339..296eb1d0 100644 --- a/tests/testthat/test-plotSupervisedRF.R +++ b/tests/testthat/test-plotSupervisedRF.R @@ -31,3 +31,9 @@ test_that('plotSupervisedRF plots without ROC',{ plotSupervisedRF(cls = 'day',ROC = FALSE) expect_s3_class(pl,'ggplot') }) + +test_that('plotting skipped when errors encountered during random forest training',{ + expect_warning(pl <- analysisData(abr1$neg,abr1$fact) %>% + keepClasses(cls = 'day',classes = 'H') %>% + plotSupervisedRF(cls = 'day')) +}) diff --git a/tests/testthat/test-randomForest.R b/tests/testthat/test-randomForest.R index ca55b886..20bda1d8 100644 --- a/tests/testthat/test-randomForest.R +++ b/tests/testthat/test-randomForest.R @@ -36,6 +36,12 @@ test_that('binary classification works',{ expect_s4_class(rf,'RandomForest') }) +test_that('classification throws an error when less than 2 classes available',{ + expect_error(d %>% + keepClasses(cls = 'day',classes = 'H') %>% + randomForest(cls = 'day')) +}) + test_that('random forest regression works',{ rf <- randomForest(d,cls = 'injorder',perm = 3,returnModels = TRUE)