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

Make example checkable + delete import rpart function

This commit is contained in:
François Vieille 2018-02-03 13:18:19 +01:00
parent bcdb2dc1c3
commit e1355147ea
12 changed files with 111 additions and 113 deletions

View file

@ -32,23 +32,24 @@
#' @return \code{VT.difft} #' @return \code{VT.difft}
#' #'
#' @examples #' @examples
#' \dontrun{ #'
#' # data(sepsis) #' data(sepsis)
#' vt.o <- vt.data(sepsis, "survival", "THERAPY", T) #' vt.o <- vt.data(sepsis, "survival", "THERAPY", T)
#' # inside model : #' # inside model :
#' vt.f <- vt.forest("one", vt.o) #' vt.f <- vt.forest("one", vt.o)
#' # ... #' # ...
#' # your model : #' # your model :
#' rf <- randomForest(y = vt.o$getY(), #' # library(randomForest)
#' x = vt.o$getX(int = T), #' # rf <- randomForest(y = vt.o$getY(),
#' mtry = 3, #' # x = vt.o$getX(int = T),
#' nodesize = 15) #' # mtry = 3,
#' vt.f <- vt.forest("one", vt.o, model = rf) #' # nodesize = 15)
#' # ... #' # vt.f <- vt.forest("one", vt.o, model = rf)
#' # Can also use ... parameters #' # ...
#' vt.f <- vt.forest("one", vt.o, mtry = 3, nodesize = 15) #' # Can also use ... parameters
#' # ... #' vt.f <- vt.forest("one", vt.o, mtry = 3, nodesize = 15)
#' } #' # ...
#'
#' #'
#' @include forest.R difft.R #' @include forest.R difft.R
#' #'

View file

@ -25,8 +25,11 @@
#' #'
#' @examples #' @examples
#' \dontrun{ #' \dontrun{
#' data.format <- formatRCTDataset(data, "outcome", "treatment", TRUE) #' data.format <- formatRCTDataset(data, "outcome", "treatment", TRUE)
#' } #' }
#' data(sepsis)
#' data.format <- formatRCTDataset(sepsis, "survival", "THERAPY", T)
#'
#' #'
#' #'
#' #'

View file

@ -13,18 +13,19 @@
#' @param ... parameters of \code{\link{VT.object}} #' @param ... parameters of \code{\link{VT.object}}
#' #'
#' @examples #' @examples
#' \dontrun{ #'
#' data(sepsis) #' data(sepsis)
#' formatRCTdataset(sepsis, "survival", "THERAPY", T) #' vt.o <- vt.data(sepsis, "survival", "THERAPY", T)
#' }
#' #'
#' @return \code{VT.object} #' @return \code{VT.object}
#' #'
#' @include object.R #' @include object.R
#' #'
#' @name vt.data #' @name vt.data
#' #'
#' @export vt.data #' @export vt.data
#'
#' @seealso \code{\link{formatRCTDataset}}
vt.data <- function(dataset, outcome.field, treatment.field, interactions = TRUE, ...){ vt.data <- function(dataset, outcome.field, treatment.field, interactions = TRUE, ...){
data <- formatRCTDataset(dataset, outcome.field, treatment.field, interactions = TRUE) data <- formatRCTDataset(dataset, outcome.field, treatment.field, interactions = TRUE)

View file

@ -18,18 +18,16 @@
#' @return data.frame of rules #' @return data.frame of rules
#' #'
#' @examples #' @examples
#' \dontrun{ #' data(sepsis)
#' # data(sepsis) #' vt.o <- vt.data(sepsis, "survival", "THERAPY", TRUE)
#' vt.o <- vt.data(sepsis, "survival", "THERAPY", T) #' # inside model :
#' # inside model : #' vt.f <- vt.forest("one", vt.o)
#' vt.f <- vt.forest("one", vt.o) #' # use classification tree
#' # use classification tree #' vt.tr <- vt.tree("class", vt.f, threshold = c(0.01, 0.05))
#' vt.tr <- vt.tree("class", vt.f, threshold = c(0.01, 0.05)) #' # show subgroups
#' # show subgroups #' subgroups <- vt.subgroups(vt.tr)
#' vt.subgroups(vt.tr) #' # change options you'll be surprised !
#' # change options you'll be surprised ! #' subgroups <- vt.subgroups(vt.tr, verbose = TRUE, tables = TRUE)
#' vt.subgroups(vt.tr, verbose = T, tables = T)
#' }
#' #'
#' @export vt.subgroups #' @export vt.subgroups
#' #'

View file

@ -11,7 +11,7 @@
#' @export VT.tree.class #' @export VT.tree.class
#' #'
#' @import methods #' @import methods
#' @importFrom rpart rpart #'
VT.tree.class <- setRefClass( VT.tree.class <- setRefClass(
Class = "VT.tree.class", Class = "VT.tree.class",

View file

@ -24,21 +24,21 @@
#' dimension. See examples. #' dimension. See examples.
#' #'
#' @examples #' @examples
#' \dontrun{ #' data(sepsis)
#' # data(sepsis) #' vt.o <- vt.data(sepsis, "survival", "THERAPY", T)
#' vt.o <- vt.data(sepsis, "survival", "THERAPY", T) #' # inside model :
#' # inside model : #' vt.f <- vt.forest("one", vt.o)
#' vt.f <- vt.forest("one", vt.o) #' # use classification tree
#' # use classification tree #' vt.tr <- vt.tree("class", vt.f, threshold = c(0.01, 0.05))
#' vt.tr <- vt.tree("class", vt.f, threshold = c(0.01, 0.05)) #' # return a list
#' # return a list #' class(vt.tr)
#' class(vt.tr) #' # access one of the tree
#' # access one of the tree #' tree1 <- vt.tr$tree1
#' vt.tr$tree1 #' # return infos
#' # return infos #' # vt.tr$tree1$getInfos()
#' vt.tr$tree1$getInfos() #' # vt.tr$tree1$getRules()
#' # ... #' # use vt.subgroups tool:
#' } #' subgroups <- vt.subgroups(vt.tr)
#' #'
#' @include tree.R #' @include tree.R
#' #'

View file

@ -16,15 +16,6 @@ aVirtualTwins is written mainly with reference classes. Briefly, there is three
\code{\link{vt.tree}} is users function. \code{\link{vt.tree}} is users function.
} }
} }
\section{TODO LIST}{ \details{
See http://github.com/prise6/aVirtualTwins for last updates.
\emph{last update : 27.07.2015}
\itemize{
\item More detailed documentation and vignettes
\item Write examples
\item ...
} }
See github.com/prise6/aVirtualTwins for last updates.
}

View file

@ -37,8 +37,11 @@ running VirtualTwins with interaction, it creates dummy variables.
} }
\examples{ \examples{
\dontrun{ \dontrun{
data.format <- formatRCTDataset(data, "outcome", "treatment", TRUE) data.format <- formatRCTDataset(data, "outcome", "treatment", TRUE)
} }
data(sepsis)
data.format <- formatRCTDataset(sepsis, "survival", "THERAPY", T)

View file

@ -27,9 +27,11 @@ interactions, set to TRUE (default value)}
a VT.object object. a VT.object object.
} }
\examples{ \examples{
\dontrun{
data(sepsis) data(sepsis)
formatRCTdataset(sepsis, "survival", "THERAPY", T) vt.o <- vt.data(sepsis, "survival", "THERAPY", T)
}
} }
\seealso{
\code{\link{formatRCTDataset}}
}

View file

@ -50,22 +50,23 @@ Is only used with forest.type = "fold". Default to 5. See
parameter forest.type, any of these class can be used with its own parameter. parameter forest.type, any of these class can be used with its own parameter.
} }
\examples{ \examples{
\dontrun{
# data(sepsis) data(sepsis)
vt.o <- vt.data(sepsis, "survival", "THERAPY", T) vt.o <- vt.data(sepsis, "survival", "THERAPY", T)
# inside model : # inside model :
vt.f <- vt.forest("one", vt.o) vt.f <- vt.forest("one", vt.o)
# ... # ...
# your model : # your model :
rf <- randomForest(y = vt.o$getY(), # library(randomForest)
x = vt.o$getX(int = T), # rf <- randomForest(y = vt.o$getY(),
mtry = 3, # x = vt.o$getX(int = T),
nodesize = 15) # mtry = 3,
vt.f <- vt.forest("one", vt.o, model = rf) # nodesize = 15)
# ... # vt.f <- vt.forest("one", vt.o, model = rf)
# Can also use ... parameters # ...
vt.f <- vt.forest("one", vt.o, mtry = 3, nodesize = 15) # Can also use ... parameters
# ... vt.f <- vt.forest("one", vt.o, mtry = 3, nodesize = 15)
} # ...
} }

View file

@ -32,17 +32,15 @@ Function which uses \code{\link{VT.tree}} intern functions. Package
rpart.plot must be loaded. See \code{\link{VT.tree}} for details. rpart.plot must be loaded. See \code{\link{VT.tree}} for details.
} }
\examples{ \examples{
\dontrun{ data(sepsis)
# data(sepsis) vt.o <- vt.data(sepsis, "survival", "THERAPY", TRUE)
vt.o <- vt.data(sepsis, "survival", "THERAPY", T) # inside model :
# inside model : vt.f <- vt.forest("one", vt.o)
vt.f <- vt.forest("one", vt.o) # use classification tree
# use classification tree vt.tr <- vt.tree("class", vt.f, threshold = c(0.01, 0.05))
vt.tr <- vt.tree("class", vt.f, threshold = c(0.01, 0.05)) # show subgroups
# show subgroups subgroups <- vt.subgroups(vt.tr)
vt.subgroups(vt.tr) # change options you'll be surprised !
# change options you'll be surprised ! subgroups <- vt.subgroups(vt.tr, verbose = TRUE, tables = TRUE)
vt.subgroups(vt.tr, verbose = T, tables = T)
}
} }

View file

@ -39,20 +39,20 @@ See \code{\link{VT.tree}}, \code{\link{VT.tree.class}} and
\code{\link{VT.tree.reg}} classes. \code{\link{VT.tree.reg}} classes.
} }
\examples{ \examples{
\dontrun{ data(sepsis)
# data(sepsis) vt.o <- vt.data(sepsis, "survival", "THERAPY", T)
vt.o <- vt.data(sepsis, "survival", "THERAPY", T) # inside model :
# inside model : vt.f <- vt.forest("one", vt.o)
vt.f <- vt.forest("one", vt.o) # use classification tree
# use classification tree vt.tr <- vt.tree("class", vt.f, threshold = c(0.01, 0.05))
vt.tr <- vt.tree("class", vt.f, threshold = c(0.01, 0.05)) # return a list
# return a list class(vt.tr)
class(vt.tr) # access one of the tree
# access one of the tree tree1 <- vt.tr$tree1
vt.tr$tree1 # return infos
# return infos # vt.tr$tree1$getInfos()
vt.tr$tree1$getInfos() # vt.tr$tree1$getRules()
# ... # use vt.subgroups tool:
} subgroups <- vt.subgroups(vt.tr)
} }