From 05a97ff613e8a6cca45a4c22a079d796e9f7cf61 Mon Sep 17 00:00:00 2001 From: prise6 Date: Wed, 10 Jun 2015 14:37:49 +0200 Subject: [PATCH] Update export/depends/suggests --- DESCRIPTION | 23 ++++++++++++++--------- NAMESPACE | 1 + R/predict.R | 13 +++++++------ 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 796568b..92c2ebe 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,18 +1,22 @@ Package: VirtualTwins Type: Package -Title: What the package does (short line) -Version: 1.0 +Title: Adaptation of Virtual Twins method from Jared Foster. +Version: 0.0.0.1000 Date: 2015-05-31 -Author: Who wrote it -Maintainer: Who to complain to -Description: More about what it does (maybe more than one line) -License: What license is it under? +Author: François Vieille +Maintainer: +Description: Research of subgroups in random clinical trials with binary + outcome and two treatments groups. +License: MIT Imports: - rpart + rpart, + party Suggests: randomForest, - caret, - party + caret +Depends: + R (>= 3.2.0), + methods Collate: 'VirtualTwins.R' 'object.R' @@ -23,6 +27,7 @@ Collate: 'forest.double.R' 'forest.fold.R' 'forest.one.R' + 'formatRCTDataset.R' 'incidences.R' 'tools.R' 'tree.R' diff --git a/NAMESPACE b/NAMESPACE index c6fddc6..52fead9 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,4 +1,5 @@ # Generated by roxygen2 (4.1.1): do not edit by hand +export(formatRCTDataset) import(methods) importClassesFrom(party,RandomForest) diff --git a/R/predict.R b/R/predict.R index 35fefdc..b42d233 100644 --- a/R/predict.R +++ b/R/predict.R @@ -17,6 +17,7 @@ #' #' @include setClass.R #' @importClassesFrom party RandomForest +#' setGeneric("VT.predict", function(rfor, newdata, type){standardGeneric("VT.predict")} ) @@ -29,7 +30,7 @@ setMethod( if(! type %in% c("binary", "continous")) stop("Type must be Binary or continous") if(type == "binary"){ if(!requireNamespace("party", quietly = TRUE)) stop("Party package must be loaded.") - tmp <- predict.RandomForest(rfor, OOB = T, type = "prob") + tmp <- party:::predict.RandomForest(rfor, OOB = T, type = "prob") tmp <- unlist(tmp) tmp <- tmp[seq(2, length(tmp), 2)] }else{ @@ -49,7 +50,7 @@ setMethod( if(! type %in% c("binary", "continous")) stop("Type must be Binary or continous") if(type == "binary"){ if(!requireNamespace("party", quietly = TRUE)) stop("Party package must be loaded.") - tmp <- predict.RandomForest(rfor, newdata = newdata, type = "prob") + tmp <- party:::predict.RandomForest(rfor, newdata = newdata, type = "prob") tmp <- unlist(tmp) tmp <- tmp[seq(2, length(tmp), 2)] }else{ @@ -71,7 +72,7 @@ setMethod( # no longer available in all version ?! # tmp <- rfor$vote[, 2] # get the "o" prob if(!requireNamespace("randomForest", quietly = TRUE)) stop("randomForest package must be loaded.") - tmp <- predict.randomForest(rfor, type = "prob")[, 2] # We want to get the "o" prob + tmp <- randomForest:::predict.randomForest(rfor, type = "prob")[, 2] # We want to get the "o" prob }else{ message("continous is not done yet") tmp <- NULL @@ -88,7 +89,7 @@ setMethod( if(! type %in% c("binary", "continous")) stop("Type must be Binary or continous") if(type == "binary"){ if(!requireNamespace("randomForest", quietly = TRUE)) stop("randomForest package must be loaded.") - tmp <- predict.randomForest(rfor, newdata = newdata, type = "prob")[, 2] # We want to get the "o" prob + tmp <- randomForest:::predict.randomForest(rfor, newdata = newdata, type = "prob")[, 2] # We want to get the "o" prob }else{ message("continous is not done yet") tmp <- NULL @@ -102,7 +103,7 @@ setMethod( f = "VT.predict", signature = c(rfor = "train", newdata = "ANY", type = "character"), function(rfor, newdata, type = "binary"){ - if(!requireNamespace("caret", quietly = TRUE)) stop("randomForest package must be loaded.") + if(!requireNamespace("caret", quietly = TRUE)) stop("caret package must be loaded.") return(VT.predict(rfor$finalModel, newdata, type)) } ) @@ -112,7 +113,7 @@ setMethod( f = "VT.predict", signature = c(rfor = "train", newdata = "missing", type = "character"), function(rfor, type = "binary"){ - if(!requireNamespace("caret", quietly = TRUE)) stop("randomForest package must be loaded.") + if(!requireNamespace("caret", quietly = TRUE)) stop("caret package must be loaded.") return(VT.predict(rfor=rfor$finalModel, type=type)) } ) \ No newline at end of file