From a7b27f51b2e3c8846c3050843d6b72091b9a24ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Vieille?= Date: Tue, 30 Jan 2018 23:43:25 +0100 Subject: [PATCH 1/8] Add 'rmarkdown' in suggest field + update infos --- .Rbuildignore | 3 ++- .gitignore | 1 + DESCRIPTION | 7 ++++--- NEWS | 7 +++++++ cran-comments.md | 29 +++++++++++++++++++++++++++++ man/VT.difft.Rd | 3 ++- man/VT.forest-abstract.Rd | 3 ++- man/VT.forest.double.Rd | 3 ++- man/VT.forest.fold.Rd | 3 ++- man/VT.forest.one.Rd | 3 ++- man/VT.object.Rd | 3 ++- man/VT.predict.Rd | 4 ++-- man/VT.tree-abstract.Rd | 3 ++- man/aVirtualTwins.Rd | 1 + man/formatRCTDataset.Rd | 1 - man/sepsis.Rd | 1 - man/vt.data.Rd | 1 - man/vt.forest.Rd | 1 - man/vt.subgroups.Rd | 1 - man/vt.tree.Rd | 1 - revdep/check.R | 5 +++++ revdep/checks.rds | Bin 0 -> 578 bytes 22 files changed, 65 insertions(+), 19 deletions(-) create mode 100644 revdep/check.R create mode 100644 revdep/checks.rds diff --git a/.Rbuildignore b/.Rbuildignore index 794a039..272d789 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -3,4 +3,5 @@ ^data-raw$ ^draft$ ^NEWS$ -^cran-comments.md$ \ No newline at end of file +^cran-comments.md$ +^revdep$ diff --git a/.gitignore b/.gitignore index c4a8ce8..4b6d732 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ .RData /drafts/* inst/doc +/revdep/.cache.rds diff --git a/DESCRIPTION b/DESCRIPTION index 57e2895..30aeb58 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: aVirtualTwins Type: Package Title: Adaptation of Virtual Twins Method from Jared Foster -Version: 1.0.0.9000 +Version: 1.0.1 Date: 2016-10-09 Authors@R: person("Francois", "Vieille", email = "vieille.francois@gmail.com", role = c("aut", "cre")) @@ -18,7 +18,8 @@ Imports: Suggests: caret, knitr, - rpart.plot + rpart.plot, + rmarkdown Depends: R (>= 3.2.0), Collate: @@ -42,4 +43,4 @@ Collate: 'tree.reg.R' 'tree.wrapper.R' VignetteBuilder: knitr -RoxygenNote: 5.0.1 +RoxygenNote: 6.0.1 diff --git a/NEWS b/NEWS index 4aeffce..2d8fc05 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,10 @@ +aVirtualTwins 1.0.1 (2018-01-30) +---------------------------------------------------------------- + +* Fix CRAN warning : CRAN packages using undeclared packages in vignettes +* waiting for submission approval + + aVirtualTwins 1.0.0.9000 (2016-10-10) ---------------------------------------------------------------- diff --git a/cran-comments.md b/cran-comments.md index ee3e4f2..9ebf9bc 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,3 +1,32 @@ +This is the second submission + +---------------------------------------------------------------- + +## v1.0.1 : patch to cran warning: + +>CRAN packages using undeclared packages in vignettes + +`rmarkdown` seems to be the issue. Added rmarkdown to suggest field. + +## Test environments + +* Linux, Debian jessie, R 3.4.3 +* win-builder (devel and release) + + +## R CMD check result + +Status: OK + +R CMD check results +0 errors | 0 warnings | 0 notes + + + + + + + This is the first submission ---------------------------------------------------------------- diff --git a/man/VT.difft.Rd b/man/VT.difft.Rd index 36ce963..48392e7 100644 --- a/man/VT.difft.Rd +++ b/man/VT.difft.Rd @@ -33,13 +33,14 @@ So \emph{absolute} method is : \item{\code{difft}}{vector of difference between twin1 and twin2} }} + \section{Methods}{ \describe{ \item{\code{computeDifft()}}{Compute difference between twin1 and twin2. See details.} }} + \seealso{ \code{\link{VT.forest}}, \code{\link{VT.forest.one}}, \code{\link{VT.forest.double}} } - diff --git a/man/VT.forest-abstract.Rd b/man/VT.forest-abstract.Rd index 0dcffce..6765e38 100644 --- a/man/VT.forest-abstract.Rd +++ b/man/VT.forest-abstract.Rd @@ -14,6 +14,7 @@ An abstract reference class to compute twin via random forests \describe{ \item{\code{...}}{see fields of \code{\link{VT.difft}}} }} + \section{Methods}{ \describe{ @@ -23,7 +24,7 @@ An abstract reference class to compute twin via random forests \item{\code{run()}}{Compute twin1 and twin2 estimation. Switch treatment if necessary.} }} + \seealso{ \code{\link{VT.difft}}, \code{\link{VT.forest.one}}, \code{\link{VT.forest.double}} } - diff --git a/man/VT.forest.double.Rd b/man/VT.forest.double.Rd index 8b49bc4..79d7955 100644 --- a/man/VT.forest.double.Rd +++ b/man/VT.forest.double.Rd @@ -31,6 +31,7 @@ This is what \code{computeTwin2()} does. \item{\code{...}}{field from parent class : \code{\link{VT.forest}}} }} + \section{Methods}{ \describe{ @@ -38,8 +39,8 @@ This is what \code{computeTwin2()} does. \item{\code{computeTwin2()}}{Compute twin2 by the other part of data in the other forest. See details.} }} + \seealso{ \code{\link{VT.difft}}, \code{\link{VT.forest}}, \code{\link{VT.forest.one}} } - diff --git a/man/VT.forest.fold.Rd b/man/VT.forest.fold.Rd index 32c4fa3..f00c339 100644 --- a/man/VT.forest.fold.Rd +++ b/man/VT.forest.fold.Rd @@ -28,13 +28,14 @@ interactions} \item{\code{...}}{field from parent class : \code{\link{VT.forest}}} }} + \section{Methods}{ \describe{ \item{\code{run()}}{Compute twin1 and twin2 estimation. Switch treatment if necessary.} }} + \seealso{ \code{\link{VT.difft}}, \code{\link{VT.forest}}, \code{\link{VT.forest.one}}, \code{\link{VT.forest.double}} } - diff --git a/man/VT.forest.one.Rd b/man/VT.forest.one.Rd index e9e4005..0227c31 100644 --- a/man/VT.forest.one.Rd +++ b/man/VT.forest.one.Rd @@ -24,6 +24,7 @@ what \code{computeTwin1()} and \code{computeTwin2()} functions do. \item{\code{...}}{field from parent class : \code{\link{VT.forest}}} }} + \section{Methods}{ \describe{ @@ -31,7 +32,7 @@ what \code{computeTwin1()} and \code{computeTwin2()} functions do. \item{\code{computeTwin2()}}{Compute twin2 by switching treatment and applying random forest model} }} + \seealso{ \code{\link{VT.difft}}, \code{\link{VT.forest}}, \code{\link{VT.forest.double}} } - diff --git a/man/VT.object.Rd b/man/VT.object.Rd index a4c1f76..c211f69 100644 --- a/man/VT.object.Rd +++ b/man/VT.object.Rd @@ -33,6 +33,7 @@ treatments.} \item{\code{type}}{Character : binary or continous. Only binary is currently available.} }} + \section{Methods}{ \describe{ @@ -53,6 +54,7 @@ If trt is not NULL, return predictors for T = trt} \item{\code{switchTreatment()}}{Switch treatment value.} }} + \examples{ \dontrun{ # Default use : @@ -78,4 +80,3 @@ vt.o$getIncidences() \seealso{ \code{\link{VT.difft}} } - diff --git a/man/VT.predict.Rd b/man/VT.predict.Rd index 1c7a49b..e157a41 100644 --- a/man/VT.predict.Rd +++ b/man/VT.predict.Rd @@ -3,10 +3,10 @@ \docType{methods} \name{VT.predict} \alias{VT.predict} -\alias{VT.predict,RandomForest,data.frame,character-method} \alias{VT.predict,RandomForest,missing,character-method} -\alias{VT.predict,randomForest,data.frame,character-method} +\alias{VT.predict,RandomForest,data.frame,character-method} \alias{VT.predict,randomForest,missing,character-method} +\alias{VT.predict,randomForest,data.frame,character-method} \alias{VT.predict,train,ANY,character-method} \alias{VT.predict,train,missing,character-method} \title{VT.predict generic function} diff --git a/man/VT.tree-abstract.Rd b/man/VT.tree-abstract.Rd index ac7121b..d6bedb7 100644 --- a/man/VT.tree-abstract.Rd +++ b/man/VT.tree-abstract.Rd @@ -52,6 +52,7 @@ screening field} \item{\code{Ahat}}{vector Indicator of beglonging to Ahat} }} + \section{Methods}{ \describe{ @@ -74,7 +75,7 @@ screening field} \item{\code{run(...)}}{Compute tree with rpart parameters} }} + \seealso{ \code{\link{VT.tree.reg}}, \code{\link{VT.tree.class}} } - diff --git a/man/aVirtualTwins.Rd b/man/aVirtualTwins.Rd index da56540..8f91663 100644 --- a/man/aVirtualTwins.Rd +++ b/man/aVirtualTwins.Rd @@ -4,6 +4,7 @@ \name{aVirtualTwins} \alias{aVirtualTwins} \alias{aVirtualTwins-package} +\alias{aVirtualTwins-package} \title{aVirtualTwins : An adapation of VirtualTwins method created by Jared Foster.} \description{ aVirtualTwins is written mainly with reference classes. Briefly, there is three kinds of class : diff --git a/man/formatRCTDataset.Rd b/man/formatRCTDataset.Rd index 6501c09..0844031 100644 --- a/man/formatRCTDataset.Rd +++ b/man/formatRCTDataset.Rd @@ -43,4 +43,3 @@ data.format <- formatRCTDataset(data, "outcome", "treatment", TRUE) } - diff --git a/man/sepsis.Rd b/man/sepsis.Rd index e902206..7579398 100644 --- a/man/sepsis.Rd +++ b/man/sepsis.Rd @@ -43,4 +43,3 @@ True subgroup is \emph{PRAPACHE <= 26 & AGE <= 49.80}. \emph{NOTE:} This subgroup is defined with the \emph{lower} event rate (survival = 1) in treatement arm. } - diff --git a/man/vt.data.Rd b/man/vt.data.Rd index 2f5d78d..1b4ddb2 100644 --- a/man/vt.data.Rd +++ b/man/vt.data.Rd @@ -33,4 +33,3 @@ a VT.object object. } } - diff --git a/man/vt.forest.Rd b/man/vt.forest.Rd index e47bbc8..ffbf0e1 100644 --- a/man/vt.forest.Rd +++ b/man/vt.forest.Rd @@ -69,4 +69,3 @@ parameter forest.type, any of these class can be used with its own parameter. } } - diff --git a/man/vt.subgroups.Rd b/man/vt.subgroups.Rd index c4a072d..5eb2f65 100644 --- a/man/vt.subgroups.Rd +++ b/man/vt.subgroups.Rd @@ -46,4 +46,3 @@ rpart.plot must be loaded. See \code{\link{VT.tree}} for details. } } - diff --git a/man/vt.tree.Rd b/man/vt.tree.Rd index a5c252d..f2e6241 100644 --- a/man/vt.tree.Rd +++ b/man/vt.tree.Rd @@ -56,4 +56,3 @@ See \code{\link{VT.tree}}, \code{\link{VT.tree.class}} and } } - diff --git a/revdep/check.R b/revdep/check.R new file mode 100644 index 0000000..e262948 --- /dev/null +++ b/revdep/check.R @@ -0,0 +1,5 @@ +library("devtools") + +revdep_check() +revdep_check_save_summary() +revdep_check_print_problems() diff --git a/revdep/checks.rds b/revdep/checks.rds new file mode 100644 index 0000000000000000000000000000000000000000..82941ab781f929cfe10e42f35fb0fb2bbff64156 GIT binary patch literal 578 zcmV-I0=@koiwFP!000001C>-kZ<{a_CL}CL+f1EyoivWgG`pBELT=rmIaX8FO}j-F zI1viL$UxKXw4c3GGZXwEaZfuK{J!_S=jX@!_;q0zhG}$rUBm2F+xPO(lk3GWy4Aif z*R@<7i4Nua!_t0aB9D1$PqBxm_SkjE3=x8+&P3zBdkXxO?|rtDI4z&hCM|Ws@_SK6 zF}KGA6YP<>o}o9syVtSHwOB2d_{YNn1)A&Xt`t0DH{Ym;bIo@l>kN=n)hY9uCmt)M zI|lT=0{iNg%6yYQ=LOp-%PeEH8zeN{lyt)&EaXW-3oy;%H{2wuQ0?F_p}Ah?D3kGP zE_SOpUGtMKVJYGOi1cSHijpP|`#8;;lvJ<+jBOeh0*s7`;u#txXd3a|f(w=ddnk5P zY$LvhJ6oa(f%Y8@oF%-_>gaq@8{@y<=ZP$W9ZaC%K6cP7fbPlpn71?+c|h~9kBF!&t&R=n+C&(8Wf}GhoM;0*C^E4&Z9LGbhqt*2> z;UP`zaVCeD`8Q{u`S$+nMA6=c@*~>g+qzMJUMaL{7+|9Yla15E>jnaP*-(SmL~=re zoX5sa>cQ?D)J-fQOc@D*EA@kI_I{xhpt$3sMonbvFT(HN8WuUeJXcd|-eJqVw8pbSdL-H~y Qs={CX0b3CeAZ`T!0KlgmlK=n! literal 0 HcmV?d00001 From e064cdc1f5c700471712d0f8e991663bb596f8fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Vieille?= Date: Wed, 31 Jan 2018 00:40:38 +0100 Subject: [PATCH 2/8] add e1071 to suggest field --- DESCRIPTION | 3 ++- README.md | 2 +- cran-comments.md | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 30aeb58..bdd46bf 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -19,7 +19,8 @@ Suggests: caret, knitr, rpart.plot, - rmarkdown + rmarkdown, + e1071 Depends: R (>= 3.2.0), Collate: diff --git a/README.md b/README.md index 9d37724..67dc8b0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # aVirtualTwins -[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/aVirtualTwins)](http://cran.r-project.org/package=aVirtualTwins) +[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/aVirtualTwins)](https://cran.r-project.org/package=aVirtualTwins) An adaptation of VirtualTwins method from [Foster, J. C., Taylor, J. M.G. and Ruberg, S. J. (2011)](http://onlinelibrary.wiley.com/doi/10.1002/sim.4322/abstract) diff --git a/cran-comments.md b/cran-comments.md index 9ebf9bc..c196714 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -6,7 +6,8 @@ This is the second submission >CRAN packages using undeclared packages in vignettes -`rmarkdown` seems to be the issue. Added rmarkdown to suggest field. +`rmarkdown` seems to be the issue. Added `rmarkdown` to suggest field. +`e1071` was added too. ## Test environments From cb252c771e2d57847a75f03a01110950c8262908 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Vieille?= Date: Sat, 3 Feb 2018 13:17:03 +0100 Subject: [PATCH 3/8] Add infos about Jared Foster --- DESCRIPTION | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index bdd46bf..07d7076 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,10 +2,10 @@ Package: aVirtualTwins Type: Package Title: Adaptation of Virtual Twins Method from Jared Foster Version: 1.0.1 -Date: 2016-10-09 -Authors@R: person("Francois", "Vieille", email = "vieille.francois@gmail.com", - role = c("aut", "cre")) -Description: Research of subgroups in random clinical trials with binary outcome and two treatments groups. This is an adaptation of the Jared Foster method. +Date: 2018-02-03 +Authors@R: c(person("Francois", "Vieille", email = "vieille.francois@gmail.com", + role = c("aut", "cre")), person("Jared", "Foster", email = "jared.foster@nih.gov", role = c("aut"))) +Description: Research of subgroups in random clinical trials with binary outcome and two treatments groups. This is an adaptation of the Jared Foster method (). License: GPL-3 | file LICENSE URL: https://github.com/prise6/aVirtualTwins BugReports: https://github.com/prise6/aVirtualTwins/issues From bcdb2dc1c376f9cbec8dad60d09ab7acf929607b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Vieille?= Date: Sat, 3 Feb 2018 13:17:29 +0100 Subject: [PATCH 4/8] Delete todo list --- R/aVirtualTwins.R | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/R/aVirtualTwins.R b/R/aVirtualTwins.R index e527097..f64828c 100644 --- a/R/aVirtualTwins.R +++ b/R/aVirtualTwins.R @@ -10,15 +10,8 @@ #' \code{\link{vt.tree}} is users function. #' } #' -#' @section TODO LIST: -#' \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. +#' See http://github.com/prise6/aVirtualTwins for last updates. #' #' @docType package #' @name aVirtualTwins From e1355147eaa5a01d1b67ef95a4e94a8c1b89da29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Vieille?= Date: Sat, 3 Feb 2018 13:18:19 +0100 Subject: [PATCH 5/8] Make example checkable + delete import rpart function --- R/forest.wrapper.R | 35 ++++++++++++++++++----------------- R/formatRCTDataset.R | 7 +++++-- R/object.wrapper.R | 11 ++++++----- R/tools.R | 22 ++++++++++------------ R/tree.class.R | 2 +- R/tree.wrapper.R | 30 +++++++++++++++--------------- man/aVirtualTwins.Rd | 13 ++----------- man/formatRCTDataset.Rd | 7 +++++-- man/vt.data.Rd | 10 ++++++---- man/vt.forest.Rd | 35 ++++++++++++++++++----------------- man/vt.subgroups.Rd | 22 ++++++++++------------ man/vt.tree.Rd | 30 +++++++++++++++--------------- 12 files changed, 111 insertions(+), 113 deletions(-) diff --git a/R/forest.wrapper.R b/R/forest.wrapper.R index e5c5d14..1500c82 100644 --- a/R/forest.wrapper.R +++ b/R/forest.wrapper.R @@ -32,23 +32,24 @@ #' @return \code{VT.difft} #' #' @examples -#' \dontrun{ -#' # data(sepsis) -#' vt.o <- vt.data(sepsis, "survival", "THERAPY", T) -#' # inside model : -#' vt.f <- vt.forest("one", vt.o) -#' # ... -#' # your model : -#' rf <- randomForest(y = vt.o$getY(), -#' x = vt.o$getX(int = T), -#' mtry = 3, -#' 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) -#' # ... -#' } +#' +#' data(sepsis) +#' vt.o <- vt.data(sepsis, "survival", "THERAPY", T) +#' # inside model : +#' vt.f <- vt.forest("one", vt.o) +#' # ... +#' # your model : +#' # library(randomForest) +#' # rf <- randomForest(y = vt.o$getY(), +#' # x = vt.o$getX(int = T), +#' # mtry = 3, +#' # 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) +#' # ... +#' #' #' @include forest.R difft.R #' diff --git a/R/formatRCTDataset.R b/R/formatRCTDataset.R index d37c099..a4fbfa9 100644 --- a/R/formatRCTDataset.R +++ b/R/formatRCTDataset.R @@ -25,8 +25,11 @@ #' #' @examples #' \dontrun{ -#' data.format <- formatRCTDataset(data, "outcome", "treatment", TRUE) -#' } +#' data.format <- formatRCTDataset(data, "outcome", "treatment", TRUE) +#' } +#' data(sepsis) +#' data.format <- formatRCTDataset(sepsis, "survival", "THERAPY", T) +#' #' #' #' diff --git a/R/object.wrapper.R b/R/object.wrapper.R index c09d1c0..bf69b5c 100644 --- a/R/object.wrapper.R +++ b/R/object.wrapper.R @@ -13,18 +13,19 @@ #' @param ... parameters of \code{\link{VT.object}} #' #' @examples -#' \dontrun{ -#' data(sepsis) -#' formatRCTdataset(sepsis, "survival", "THERAPY", T) -#' } +#' +#' data(sepsis) +#' vt.o <- vt.data(sepsis, "survival", "THERAPY", T) #' #' @return \code{VT.object} #' -#' @include object.R +#' @include object.R #' #' @name vt.data #' #' @export vt.data +#' +#' @seealso \code{\link{formatRCTDataset}} vt.data <- function(dataset, outcome.field, treatment.field, interactions = TRUE, ...){ data <- formatRCTDataset(dataset, outcome.field, treatment.field, interactions = TRUE) diff --git a/R/tools.R b/R/tools.R index 4deb750..94974aa 100644 --- a/R/tools.R +++ b/R/tools.R @@ -18,18 +18,16 @@ #' @return data.frame of rules #' #' @examples -#' \dontrun{ -#' # data(sepsis) -#' vt.o <- vt.data(sepsis, "survival", "THERAPY", T) -#' # inside model : -#' vt.f <- vt.forest("one", vt.o) -#' # use classification tree -#' vt.tr <- vt.tree("class", vt.f, threshold = c(0.01, 0.05)) -#' # show subgroups -#' vt.subgroups(vt.tr) -#' # change options you'll be surprised ! -#' vt.subgroups(vt.tr, verbose = T, tables = T) -#' } +#' data(sepsis) +#' vt.o <- vt.data(sepsis, "survival", "THERAPY", TRUE) +#' # inside model : +#' vt.f <- vt.forest("one", vt.o) +#' # use classification tree +#' vt.tr <- vt.tree("class", vt.f, threshold = c(0.01, 0.05)) +#' # show subgroups +#' subgroups <- vt.subgroups(vt.tr) +#' # change options you'll be surprised ! +#' subgroups <- vt.subgroups(vt.tr, verbose = TRUE, tables = TRUE) #' #' @export vt.subgroups #' diff --git a/R/tree.class.R b/R/tree.class.R index a2d6e9a..147eed3 100644 --- a/R/tree.class.R +++ b/R/tree.class.R @@ -11,7 +11,7 @@ #' @export VT.tree.class #' #' @import methods -#' @importFrom rpart rpart +#' VT.tree.class <- setRefClass( Class = "VT.tree.class", diff --git a/R/tree.wrapper.R b/R/tree.wrapper.R index 2a1cfec..43a5358 100644 --- a/R/tree.wrapper.R +++ b/R/tree.wrapper.R @@ -24,21 +24,21 @@ #' dimension. See examples. #' #' @examples -#' \dontrun{ -#' # data(sepsis) -#' vt.o <- vt.data(sepsis, "survival", "THERAPY", T) -#' # inside model : -#' vt.f <- vt.forest("one", vt.o) -#' # use classification tree -#' vt.tr <- vt.tree("class", vt.f, threshold = c(0.01, 0.05)) -#' # return a list -#' class(vt.tr) -#' # access one of the tree -#' vt.tr$tree1 -#' # return infos -#' vt.tr$tree1$getInfos() -#' # ... -#' } +#' data(sepsis) +#' vt.o <- vt.data(sepsis, "survival", "THERAPY", T) +#' # inside model : +#' vt.f <- vt.forest("one", vt.o) +#' # use classification tree +#' vt.tr <- vt.tree("class", vt.f, threshold = c(0.01, 0.05)) +#' # return a list +#' class(vt.tr) +#' # access one of the tree +#' tree1 <- vt.tr$tree1 +#' # return infos +#' # vt.tr$tree1$getInfos() +#' # vt.tr$tree1$getRules() +#' # use vt.subgroups tool: +#' subgroups <- vt.subgroups(vt.tr) #' #' @include tree.R #' diff --git a/man/aVirtualTwins.Rd b/man/aVirtualTwins.Rd index 8f91663..b4e8383 100644 --- a/man/aVirtualTwins.Rd +++ b/man/aVirtualTwins.Rd @@ -16,15 +16,6 @@ aVirtualTwins is written mainly with reference classes. Briefly, there is three \code{\link{vt.tree}} is users function. } } -\section{TODO LIST}{ - -\emph{last update : 27.07.2015} -\itemize{ - \item More detailed documentation and vignettes - \item Write examples - \item ... +\details{ +See http://github.com/prise6/aVirtualTwins for last updates. } - -See github.com/prise6/aVirtualTwins for last updates. -} - diff --git a/man/formatRCTDataset.Rd b/man/formatRCTDataset.Rd index 0844031..db8ccf9 100644 --- a/man/formatRCTDataset.Rd +++ b/man/formatRCTDataset.Rd @@ -37,8 +37,11 @@ running VirtualTwins with interaction, it creates dummy variables. } \examples{ \dontrun{ -data.format <- formatRCTDataset(data, "outcome", "treatment", TRUE) -} + data.format <- formatRCTDataset(data, "outcome", "treatment", TRUE) +} +data(sepsis) +data.format <- formatRCTDataset(sepsis, "survival", "THERAPY", T) + diff --git a/man/vt.data.Rd b/man/vt.data.Rd index 1b4ddb2..050b80b 100644 --- a/man/vt.data.Rd +++ b/man/vt.data.Rd @@ -27,9 +27,11 @@ interactions, set to TRUE (default value)} a VT.object object. } \examples{ -\dontrun{ - data(sepsis) - formatRCTdataset(sepsis, "survival", "THERAPY", T) -} + +data(sepsis) +vt.o <- vt.data(sepsis, "survival", "THERAPY", T) } +\seealso{ +\code{\link{formatRCTDataset}} +} diff --git a/man/vt.forest.Rd b/man/vt.forest.Rd index ffbf0e1..71abbb3 100644 --- a/man/vt.forest.Rd +++ b/man/vt.forest.Rd @@ -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. } \examples{ -\dontrun{ - # data(sepsis) - vt.o <- vt.data(sepsis, "survival", "THERAPY", T) - # inside model : - vt.f <- vt.forest("one", vt.o) - # ... - # your model : - rf <- randomForest(y = vt.o$getY(), - x = vt.o$getX(int = T), - mtry = 3, - 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) - # ... -} + +data(sepsis) +vt.o <- vt.data(sepsis, "survival", "THERAPY", T) +# inside model : +vt.f <- vt.forest("one", vt.o) +# ... +# your model : +# library(randomForest) +# rf <- randomForest(y = vt.o$getY(), +# x = vt.o$getX(int = T), +# mtry = 3, +# 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) +# ... + } diff --git a/man/vt.subgroups.Rd b/man/vt.subgroups.Rd index 5eb2f65..935bb1e 100644 --- a/man/vt.subgroups.Rd +++ b/man/vt.subgroups.Rd @@ -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. } \examples{ -\dontrun{ - # data(sepsis) - vt.o <- vt.data(sepsis, "survival", "THERAPY", T) - # inside model : - vt.f <- vt.forest("one", vt.o) - # use classification tree - vt.tr <- vt.tree("class", vt.f, threshold = c(0.01, 0.05)) - # show subgroups - vt.subgroups(vt.tr) - # change options you'll be surprised ! - vt.subgroups(vt.tr, verbose = T, tables = T) -} +data(sepsis) +vt.o <- vt.data(sepsis, "survival", "THERAPY", TRUE) +# inside model : +vt.f <- vt.forest("one", vt.o) +# use classification tree +vt.tr <- vt.tree("class", vt.f, threshold = c(0.01, 0.05)) +# show subgroups +subgroups <- vt.subgroups(vt.tr) +# change options you'll be surprised ! +subgroups <- vt.subgroups(vt.tr, verbose = TRUE, tables = TRUE) } diff --git a/man/vt.tree.Rd b/man/vt.tree.Rd index f2e6241..414853f 100644 --- a/man/vt.tree.Rd +++ b/man/vt.tree.Rd @@ -39,20 +39,20 @@ See \code{\link{VT.tree}}, \code{\link{VT.tree.class}} and \code{\link{VT.tree.reg}} classes. } \examples{ -\dontrun{ - # data(sepsis) - vt.o <- vt.data(sepsis, "survival", "THERAPY", T) - # inside model : - vt.f <- vt.forest("one", vt.o) - # use classification tree - vt.tr <- vt.tree("class", vt.f, threshold = c(0.01, 0.05)) - # return a list - class(vt.tr) - # access one of the tree - vt.tr$tree1 - # return infos - vt.tr$tree1$getInfos() - # ... -} +data(sepsis) +vt.o <- vt.data(sepsis, "survival", "THERAPY", T) +# inside model : +vt.f <- vt.forest("one", vt.o) +# use classification tree +vt.tr <- vt.tree("class", vt.f, threshold = c(0.01, 0.05)) +# return a list +class(vt.tr) +# access one of the tree +tree1 <- vt.tr$tree1 +# return infos +# vt.tr$tree1$getInfos() +# vt.tr$tree1$getRules() +# use vt.subgroups tool: +subgroups <- vt.subgroups(vt.tr) } From 317bafd27bfe5789ac976ea5a405fb566513e714 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Vieille?= Date: Sat, 3 Feb 2018 13:19:05 +0100 Subject: [PATCH 6/8] Update cran submissions infos --- cran-comments.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/cran-comments.md b/cran-comments.md index c196714..9c60f8f 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,3 +1,28 @@ +This is the third submission + +---------------------------------------------------------------- + +## v1.0.1 : patch to cran fix minor issues: + +* make checkable examples +* update version date +* add reference to Jared Foster article + +## Test environments + +* Linux, Debian jessie, R 3.4.3 +* win-builder (devel and release) + + +## R CMD check result + +Status: OK + +R CMD check results +0 errors | 0 warnings | 0 notes + + + This is the second submission ---------------------------------------------------------------- From eb3ee16751c3bbb2f74cf3dab7351be18b983f95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Vieille?= Date: Sat, 3 Feb 2018 16:21:01 +0100 Subject: [PATCH 7/8] fix incidence table --- R/tools.R | 22 ++++++++++++++-------- R/tree.R | 20 ++++++++++---------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/R/tools.R b/R/tools.R index 94974aa..a77c3a7 100644 --- a/R/tools.R +++ b/R/tools.R @@ -41,7 +41,7 @@ vt.subgroups <- function(vt.trees, only.leaf = T, only.fav = T, tables = F, verb unique(do.call(rbind, subgroups)) } else{ - subgroups <- vt.tree$getRules(only.leaf = only.leaf, only.fav = only.fav, tables = tables, verbose = verbose, compete = compete) + subgroups <- vt.trees$getRules(only.leaf = only.leaf, only.fav = only.fav, tables = tables, verbose = verbose, compete = compete) } } @@ -60,21 +60,27 @@ vt.getQAOriginal <- function(response, trt, ahat){ } vt.getTable <- function(table){ - if(is.list(table)) table <- table[[1]] - Incidence <- function(X) as.character(round(X[2] / X[3], digits = 3)) + if(is.list(table)) table <- table[[1]] + Incidence <- function(X) round(X[2] / X[3], digits = 3) t <- stats::addmargins(table, margin = c(1,2), FUN = sum, quiet = T) t <- stats::addmargins(t, FUN = Incidence, margin = 1, quiet = T) - rr <- as.numeric(t["Incidence", "1"]) / as.numeric(t["Incidence", "0"]) + rr <- NA_real_ + if(nrow(t) == 4) rr <- t[4, 2] / t[4, 1] return(list(table = t, rr = rr)) } vt.getIncidence <- function(df){ if (nrow(df) == 0) table.res <- NULL + if (ncol(df) != 2) table.res <- NULL else{ - table.res <- vt.getTable(table(df[, 1], - df[, 2], - deparse.level = 2, - dnn = c("resp", "trt"))) + table.res <- vt.getTable( + table( + factor(df[, 1], levels = c(0, 1)), + factor(df[, 2], levels = c(0, 1)), + deparse.level = 2, + dnn = c("resp", "trt") + ) + ) } return(table.res) } diff --git a/R/tree.R b/R/tree.R index da7c0cd..a218299 100644 --- a/R/tree.R +++ b/R/tree.R @@ -248,17 +248,17 @@ VT.tree <- setRefClass( if(isTRUE(tables)){ cat("\n") - cat(sprintf("Incidence dans la selection \n")) + cat(sprintf("Incidence in selection \n")) print(incid$table.selected$table) cat("\n") - cat(sprintf("Risque relatif (resub) : %0.3f \n", incid$table.selected$rr)) - cat(sprintf("Risque relatif (snd) : %0.3f \n\n", incid$table.selected$rr.snd)) + cat(sprintf("Relative risk (resub) : %0.3f \n", incid$table.selected$rr)) + cat(sprintf("Relative risk (snd) : %0.3f \n\n", incid$table.selected$rr.snd)) - cat(sprintf("Incidence dans le complementaire\n")) + cat(sprintf("Incidence in complement\n")) print(incid$table.not.selected$table) cat("\n") - cat(sprintf("Risque relatif (resub) : %0.3f \n", incid$table.not.selected$rr)) - cat(sprintf("Risque relatif (snd) : %0.3f \n\n", incid$table.not.selected$rr.snd)) + cat(sprintf("Relative risk (resub) : %0.3f \n", incid$table.not.selected$rr)) + cat(sprintf("Relative risk (snd) : %0.3f \n\n", incid$table.not.selected$rr.snd)) } cat("\n\n") @@ -310,15 +310,15 @@ VT.tree <- setRefClass( table.A <- table.inc$table.selected table.A.cmpl <- table.inc$table.not.selected - cat(sprintf("Incidence dans le sous groupe A\n")) + cat(sprintf("Incidence in subgroup A\n")) print(table.A$table) cat("\n") - cat(sprintf("Risque relatif : %0.3f \n\n", table.A$risque_relatif)) + cat(sprintf("Relative risk : %0.3f \n\n", table.A$risque_relatif)) - cat(sprintf("Incidence dans le sous groupe A complementaire\n")) + cat(sprintf("Incidence in complement subgroup of A\n")) print(table.A.cmpl$table) cat("\n") - cat(sprintf("Risque relatif : %0.3f \n\n", table.A.cmpl$risque_relatif)) + cat(sprintf("Relative risk : %0.3f \n\n", table.A.cmpl$risque_relatif)) }else{ return("Empty set") } From 403c6862c012289d1ab188b070a9031725e12e1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Vieille?= Date: Sat, 3 Feb 2018 16:53:41 +0100 Subject: [PATCH 8/8] submission 4 fix table --- cran-comments.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/cran-comments.md b/cran-comments.md index 9c60f8f..d6c98ef 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,3 +1,25 @@ +submission 4 + +---------------------------------------------------------------- + +## v1.0.1 : patch to cran fix minor issues: + +* make checkable examples : fix subgroups example + +## Test environments + +* Linux, Debian jessie, R 3.4.3 +* win-builder (devel and release) + + +## R CMD check result + +Status: OK + +R CMD check results +0 errors | 0 warnings | 0 notes + + This is the third submission ----------------------------------------------------------------