From d51852e7f27fb46ea5eaea533461dcff21552903 Mon Sep 17 00:00:00 2001 From: prise6 Date: Thu, 11 Jun 2015 13:34:55 +0200 Subject: [PATCH] Added description and export --- DESCRIPTION | 2 +- NAMESPACE | 6 ++++++ R/VirtualTwins.R | 24 ++++++++++++++++++++++++ R/difft.R | 2 ++ R/forest.double.R | 4 +++- R/forest.one.R | 2 ++ R/object.R | 22 ++++++++++------------ R/tree.class.R | 2 ++ R/tree.reg.R | 2 ++ man/VT.forest.double.Rd | 2 +- man/VT.object.Rd | 12 +++++------- man/VirtualTwins-package.Rd | 32 -------------------------------- man/VirtualTwins.Rd | 29 +++++++++++++++++++++++++++++ 13 files changed, 87 insertions(+), 54 deletions(-) delete mode 100644 man/VirtualTwins-package.Rd create mode 100644 man/VirtualTwins.Rd diff --git a/DESCRIPTION b/DESCRIPTION index 948b9c9..c82f275 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -3,7 +3,7 @@ Type: Package Title: Adaptation of Virtual Twins method from Jared Foster. Version: 0.0.0.1000 Date: 2015-05-31 -Author: François Vieille +Author: Francois Vieille Maintainer: Description: Research of subgroups in random clinical trials with binary outcome and two treatments groups. diff --git a/NAMESPACE b/NAMESPACE index 52fead9..ad02209 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,5 +1,11 @@ # Generated by roxygen2 (4.1.1): do not edit by hand +export(VT.difft) +export(VT.forest.double) +export(VT.forest.one) +export(VT.object) +export(VT.tree.class) +export(VT.tree.reg) export(formatRCTDataset) import(methods) importClassesFrom(party,RandomForest) diff --git a/R/VirtualTwins.R b/R/VirtualTwins.R index e69de29..195fdba 100644 --- a/R/VirtualTwins.R +++ b/R/VirtualTwins.R @@ -0,0 +1,24 @@ + +#' VirtualTwins : An adapation of VirtualTwins method created by Jared Foster. +#' +#' VirtualTwins is written mainly with reference classes. Briefly, there is three kinds of class : +#' \itemize{ +#' \item \code{\link{VT.object}} class to represent RCT dataset used by VirtualTwins. To format correctly RCT dataset, use \code{\link{formatRCTDataset}}. +#' \item \code{\link{VT.difft}} class to compute difference between twins. Family \code{\link{VT.forest}} extends it to compute twins by random forest. +#' \item \code{\link{VT.tree}} class to find subgroups from \code{\link{difft}} by CART trees. \code{\link{VT.tree.class}} and \code{\link{VT.tree.reg}} extend it. +#' } +#' +#' @section TODO LIST: +#' \emph{last update : 11.06.2015} +#' \itemize{ +#' \item More detailed documentation and vignettes +#' \item Write wrappers for classes +#' \item Write examples +#' \item ... +#' } +#' +#' @docType package +#' @name VirtualTwins +#' @aliases VirtualTwins-package +#' +NULL \ No newline at end of file diff --git a/R/difft.R b/R/difft.R index 99e93f1..0ef722d 100644 --- a/R/difft.R +++ b/R/difft.R @@ -17,6 +17,8 @@ #' #' @name VT.difft #' +#' @export VT.difft +#' #' @seealso \code{\link{VT.forest}}, \code{\link{VT.forest.one}}, \code{\link{VT.forest.double}} #' #' @import methods diff --git a/R/forest.double.R b/R/forest.double.R index e2edee1..1fcf7f7 100644 --- a/R/forest.double.R +++ b/R/forest.double.R @@ -23,11 +23,13 @@ #' 1 #' @field model_trt0 a caret/RandomForest/randomForest object for treatment T = #' 0 -#' @field ... field from parent class : \linkS4class{VT.forest} +#' @field ... field from parent class : \code{\link{VT.forest}} #' #' @seealso \code{\link{VT.difft}}, \code{\link{VT.forest}}, #' \code{\link{VT.forest.one}} #' +#' @export VT.forest.double +#' #' @name VT.forest.double #' #' @import methods diff --git a/R/forest.one.R b/R/forest.one.R index fd510b3..859079c 100644 --- a/R/forest.one.R +++ b/R/forest.one.R @@ -22,6 +22,8 @@ #' #' @name VT.forest.one #' +#' @export VT.forest.one +#' #' @import methods VT.forest.one <- setRefClass( Class = "VT.forest.one", diff --git a/R/object.R b/R/object.R index abd8a4b..13b7dab 100644 --- a/R/object.R +++ b/R/object.R @@ -4,19 +4,18 @@ #' #' A Reference Class to deal with RCT dataset #' -#' Currently working with binary response only. Continous will come, one day. +#' Currently working with binary response only. Continous will come, one day. #' Two-levels treatment only as well. #' #' \code{data} field should be as described, however if virtual twins won't used -#' interactions, there is no need to transform factors. A tool function to -#' transform factor will come soon. +#' interactions, there is no need to transform factors. See +#' \link{formatRCTDataset} for more details. #' #' #' @field data Data.frame with format: \eqn{Y,T,X_{1}, \ldots, X_{p}}. Y must be #' two levels factor if type is binary. T must be numeric or integer. -#' @field alpha Numeric, no need in this current version. Set to \code{1}. -#' @field screening Logical, set to \code{FALSE} Set to \code{TRUE} to use \code{varimp} in trees -#' computation. +#' @field screening Logical, set to \code{FALSE} Set to \code{TRUE} to use +#' \code{varimp} in trees computation. #' @field varimp Character vector of important variables to use in trees #' computation. #' @field delta Numeric representing the difference of incidence between @@ -28,6 +27,8 @@ #' #' @name VT.object #' +#' @export VT.object +#' #' @examples #' \dontrun{ #' # Default use : @@ -49,14 +50,13 @@ #' vt.o$getIncidences() #' } #' -#' @seealso \code{\linkS4class{VT.difft}} +#' @seealso \code{\link{VT.difft}} #' VT.object <- setRefClass( Class = "VT.object", fields = list( data = "data.frame", - alpha = "numeric", screening = "logical", varimp = "character", delta = "numeric", @@ -64,14 +64,12 @@ VT.object <- setRefClass( ), methods = list( - initialize = function(screening = F, alpha = 1, type = "binary", ...){ + initialize = function(screening = F, type = "binary", ...){ .self$screening <- screening .self$type <- type - - .self$alpha <- alpha - + .self$initFields(...) }, diff --git a/R/tree.class.R b/R/tree.class.R index 37fb844..2b60da5 100644 --- a/R/tree.class.R +++ b/R/tree.class.R @@ -8,6 +8,8 @@ #' #' @name VT.tree.class #' +#' @export VT.tree.class +#' #' @import methods VT.tree.class <- setRefClass( Class = "VT.tree.class", diff --git a/R/tree.reg.R b/R/tree.reg.R index d7dde60..e912ec3 100644 --- a/R/tree.reg.R +++ b/R/tree.reg.R @@ -6,6 +6,8 @@ #' #' @include tree.R #' +#' @export VT.tree.reg +#' #' @name VT.tree.reg VT.tree.reg <- setRefClass( diff --git a/man/VT.forest.double.Rd b/man/VT.forest.double.Rd index 7b4dd57..dba4f9a 100644 --- a/man/VT.forest.double.Rd +++ b/man/VT.forest.double.Rd @@ -29,7 +29,7 @@ This is what \code{computeTwin2()} does. \item{\code{model_trt0}}{a caret/RandomForest/randomForest object for treatment T = 0} -\item{\code{...}}{field from parent class : \linkS4class{VT.forest}} +\item{\code{...}}{field from parent class : \code{\link{VT.forest}}} }} \section{Methods}{ diff --git a/man/VT.object.Rd b/man/VT.object.Rd index 5f410c9..3094fe6 100644 --- a/man/VT.object.Rd +++ b/man/VT.object.Rd @@ -12,8 +12,8 @@ Currently working with binary response only. Continous will come, one day. Two-levels treatment only as well. \code{data} field should be as described, however if virtual twins won't used -interactions, there is no need to transform factors. A tool function to -transform factor will come soon. +interactions, there is no need to transform factors. See +\link{formatRCTDataset} for more details. } \section{Fields}{ @@ -21,10 +21,8 @@ transform factor will come soon. \item{\code{data}}{Data.frame with format: \eqn{Y,T,X_{1}, \ldots, X_{p}}. Y must be two levels factor if type is binary. T must be numeric or integer.} -\item{\code{alpha}}{Numeric, no need in this current version. Set to \code{1}.} - -\item{\code{screening}}{Logical, set to \code{FALSE} Set to \code{TRUE} to use \code{varimp} in trees -computation.} +\item{\code{screening}}{Logical, set to \code{FALSE} Set to \code{TRUE} to use +\code{varimp} in trees computation.} \item{\code{varimp}}{Character vector of important variables to use in trees computation.} @@ -75,6 +73,6 @@ vt.o$getIncidences() } } \seealso{ -\code{\linkS4class{VT.difft}} +\code{\link{VT.difft}} } diff --git a/man/VirtualTwins-package.Rd b/man/VirtualTwins-package.Rd deleted file mode 100644 index 4060227..0000000 --- a/man/VirtualTwins-package.Rd +++ /dev/null @@ -1,32 +0,0 @@ -\name{VirtualTwins-package} -\alias{VirtualTwins-package} -\alias{VirtualTwins} -\docType{package} -\title{ -\packageTitle{VirtualTwins} -} -\description{ -\packageDescription{VirtualTwins} -} -\details{ - -The DESCRIPTION file: -\packageDESCRIPTION{VirtualTwins} -\packageIndices{VirtualTwins} -~~ An overview of how to use the package, including the most important functions ~~ -} -\author{ -\packageAuthor{VirtualTwins} - -Maintainer: \packageMaintainer{VirtualTwins} -} -\references{ -~~ Literature or other references for background information ~~ -} - -\keyword{ package } -\seealso{ -~~ \code{\link[:-package]{}} ~~ -} -\examples{ -} diff --git a/man/VirtualTwins.Rd b/man/VirtualTwins.Rd new file mode 100644 index 0000000..5f669f8 --- /dev/null +++ b/man/VirtualTwins.Rd @@ -0,0 +1,29 @@ +% Generated by roxygen2 (4.1.1): do not edit by hand +% Please edit documentation in R/VirtualTwins.R +\docType{package} +\name{VirtualTwins} +\alias{VirtualTwins} +\alias{VirtualTwins-package} +\title{VirtualTwins : An adapation of VirtualTwins method created by Jared Foster.} +\description{ +VirtualTwins is written mainly with reference classes. Briefly, there is three kinds of class : +\itemize{ + \item \code{\link{VT.object}} class to represent RCT dataset used by VirtualTwins. To format correctly RCT dataset, use \code{\link{formatRCTDataset}}. + \item \code{\link{VT.difft}} class to compute difference between twins. Family \code{\link{VT.forest}} extends it to compute twins by random forest. + \item \code{\link{VT.tree}} class to find subgroups from \code{\link{difft}} by CART trees. \code{\link{VT.tree.class}} and \code{\link{VT.tree.reg}} extend it. +} +} +\details{ +\encoding{UTF-8} +} +\section{TODO LIST}{ + +\emph{last update : 11.06.2015} +\itemize{ + \item More detailed documentation and vignettes + \item Write wrappers for classes + \item Write examples + \item ... +} +} +