1
0
Fork 0
mirror of https://github.com/prise6/aVirtualTwins.git synced 2024-04-27 19:12:45 +02:00

Update export/depends/suggests

This commit is contained in:
prise6 2015-06-10 14:37:49 +02:00
parent 6a4dead9a9
commit 05a97ff613
3 changed files with 22 additions and 15 deletions

View file

@ -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 <yourfault@somewhere.net>
Description: More about what it does (maybe more than one line)
License: What license is it under?
Author: François Vieille
Maintainer: <vieille.francois@gmail.com>
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'

View file

@ -1,4 +1,5 @@
# Generated by roxygen2 (4.1.1): do not edit by hand
export(formatRCTDataset)
import(methods)
importClassesFrom(party,RandomForest)

View file

@ -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))
}
)