Browse Source

Make example checkable + delete import rpart function

François Vieille 1 year ago
parent
commit
e1355147ea
12 changed files with 111 additions and 113 deletions
  1. 18
    17
      R/forest.wrapper.R
  2. 5
    2
      R/formatRCTDataset.R
  3. 6
    5
      R/object.wrapper.R
  4. 10
    12
      R/tools.R
  5. 1
    1
      R/tree.class.R
  6. 15
    15
      R/tree.wrapper.R
  7. 2
    11
      man/aVirtualTwins.Rd
  8. 5
    2
      man/formatRCTDataset.Rd
  9. 6
    4
      man/vt.data.Rd
  10. 18
    17
      man/vt.forest.Rd
  11. 10
    12
      man/vt.subgroups.Rd
  12. 15
    15
      man/vt.tree.Rd

+ 18
- 17
R/forest.wrapper.R View File

@@ -32,23 +32,24 @@
32 32
 #' @return \code{VT.difft}
33 33
 #'  
34 34
 #' @examples
35
-#' \dontrun{
36
-#'  # data(sepsis)
37
-#'  vt.o <- vt.data(sepsis, "survival", "THERAPY", T)
38
-#'  # inside model : 
39
-#'  vt.f <- vt.forest("one", vt.o)
40
-#'  # ... 
41
-#'  # your model : 
42
-#'  rf <- randomForest(y = vt.o$getY(),
43
-#'                      x = vt.o$getX(int = T),
44
-#'                      mtry = 3,
45
-#'                      nodesize = 15)
46
-#'  vt.f <- vt.forest("one", vt.o, model = rf)
47
-#'  # ...
48
-#'  # Can also use ... parameters
49
-#'  vt.f <- vt.forest("one", vt.o, mtry = 3, nodesize = 15)
50
-#'  # ...
51
-#' }   
35
+#' 
36
+#' data(sepsis)
37
+#' vt.o <- vt.data(sepsis, "survival", "THERAPY", T)
38
+#' # inside model :
39
+#' vt.f <- vt.forest("one", vt.o)
40
+#' # ...
41
+#' # your model :
42
+#' # library(randomForest)
43
+#' # rf <- randomForest(y = vt.o$getY(),
44
+#' #                    x = vt.o$getX(int = T),
45
+#' #                    mtry = 3,
46
+#' #                    nodesize = 15)
47
+#' # vt.f <- vt.forest("one", vt.o, model = rf)
48
+#' # ...
49
+#' # Can also use ... parameters
50
+#' vt.f <- vt.forest("one", vt.o, mtry = 3, nodesize = 15)
51
+#' # ...
52
+#'    
52 53
 #' 
53 54
 #' @include forest.R difft.R
54 55
 #'   

+ 5
- 2
R/formatRCTDataset.R View File

@@ -25,8 +25,11 @@
25 25
 #' 
26 26
 #' @examples
27 27
 #' \dontrun{
28
-#' data.format <- formatRCTDataset(data, "outcome", "treatment", TRUE)
29
-#' } 
28
+#'     data.format <- formatRCTDataset(data, "outcome", "treatment", TRUE)
29
+#' }
30
+#' data(sepsis)
31
+#' data.format <- formatRCTDataset(sepsis, "survival", "THERAPY", T)
32
+#'  
30 33
 #'
31 34
 #'  
32 35
 #'   

+ 6
- 5
R/object.wrapper.R View File

@@ -13,18 +13,19 @@
13 13
 #' @param ... parameters of \code{\link{VT.object}}
14 14
 #'   
15 15
 #' @examples
16
-#' \dontrun{
17
-#'  data(sepsis)
18
-#'  formatRCTdataset(sepsis, "survival", "THERAPY", T)
19
-#' }
16
+#' 
17
+#' data(sepsis)
18
+#' vt.o <- vt.data(sepsis, "survival", "THERAPY", T)
20 19
 #'   
21 20
 #' @return \code{VT.object}
22 21
 #'   
23
-#' @include object.R
22
+#' @include object.R 
24 23
 #'   
25 24
 #' @name vt.data
26 25
 #'   
27 26
 #' @export vt.data
27
+#' 
28
+#' @seealso \code{\link{formatRCTDataset}}
28 29
 
29 30
 vt.data <- function(dataset, outcome.field, treatment.field, interactions = TRUE, ...){
30 31
   data <- formatRCTDataset(dataset, outcome.field, treatment.field, interactions = TRUE)

+ 10
- 12
R/tools.R View File

@@ -18,18 +18,16 @@
18 18
 #' @return data.frame of rules
19 19
 #'   
20 20
 #' @examples 
21
-#' \dontrun{
22
-#'  # data(sepsis)
23
-#'  vt.o <- vt.data(sepsis, "survival", "THERAPY", T)
24
-#'  # inside model :
25
-#'  vt.f <- vt.forest("one", vt.o)
26
-#'  # use classification tree
27
-#'  vt.tr <- vt.tree("class", vt.f, threshold = c(0.01, 0.05))
28
-#'  # show subgroups
29
-#'  vt.subgroups(vt.tr)
30
-#'  # change options you'll be surprised !
31
-#'  vt.subgroups(vt.tr, verbose = T, tables = T) 
32
-#' }
21
+#' data(sepsis)
22
+#' vt.o <- vt.data(sepsis, "survival", "THERAPY", TRUE)
23
+#' # inside model :
24
+#' vt.f <- vt.forest("one", vt.o)
25
+#' # use classification tree
26
+#' vt.tr <- vt.tree("class", vt.f, threshold = c(0.01, 0.05))
27
+#' # show subgroups
28
+#' subgroups <- vt.subgroups(vt.tr)
29
+#' # change options you'll be surprised !
30
+#' subgroups <- vt.subgroups(vt.tr, verbose = TRUE, tables = TRUE)
33 31
 #' 
34 32
 #' @export vt.subgroups
35 33
 #'   

+ 1
- 1
R/tree.class.R View File

@@ -11,7 +11,7 @@
11 11
 #' @export VT.tree.class
12 12
 #' 
13 13
 #' @import methods 
14
-#' @importFrom rpart rpart
14
+#' 
15 15
 VT.tree.class <- setRefClass(
16 16
   Class = "VT.tree.class",
17 17
   

+ 15
- 15
R/tree.wrapper.R View File

@@ -24,21 +24,21 @@
24 24
 #'   dimension. See examples.
25 25
 #'   
26 26
 #' @examples
27
-#' \dontrun{
28
-#'  # data(sepsis)
29
-#'  vt.o <- vt.data(sepsis, "survival", "THERAPY", T)
30
-#'  # inside model : 
31
-#'  vt.f <- vt.forest("one", vt.o)
32
-#'  # use classification tree
33
-#'  vt.tr <- vt.tree("class", vt.f, threshold = c(0.01, 0.05))
34
-#'  # return a list
35
-#'  class(vt.tr)
36
-#'  # access one of the tree
37
-#'  vt.tr$tree1
38
-#'  # return infos
39
-#'  vt.tr$tree1$getInfos()
40
-#'  # ...
41
-#' }
27
+#' data(sepsis)
28
+#' vt.o <- vt.data(sepsis, "survival", "THERAPY", T)
29
+#' # inside model :
30
+#' vt.f <- vt.forest("one", vt.o)
31
+#' # use classification tree
32
+#' vt.tr <- vt.tree("class", vt.f, threshold = c(0.01, 0.05))
33
+#' # return a list
34
+#' class(vt.tr)
35
+#' # access one of the tree
36
+#' tree1 <- vt.tr$tree1
37
+#' # return infos
38
+#' # vt.tr$tree1$getInfos()
39
+#' # vt.tr$tree1$getRules()
40
+#' # use vt.subgroups tool:
41
+#' subgroups <- vt.subgroups(vt.tr)
42 42
 #'   
43 43
 #' @include tree.R
44 44
 #'   

+ 2
- 11
man/aVirtualTwins.Rd View File

@@ -16,15 +16,6 @@ aVirtualTwins is written mainly with reference classes. Briefly, there is three
16 16
  \code{\link{vt.tree}} is users function.
17 17
 }
18 18
 }
19
-\section{TODO LIST}{
20
-
21
-\emph{last update : 27.07.2015}
22
-\itemize{
23
- \item More detailed documentation and vignettes 
24
- \item Write examples
25
- \item ...
26
-}
27
-
28
-See github.com/prise6/aVirtualTwins for last updates.
19
+\details{
20
+See http://github.com/prise6/aVirtualTwins for last updates.
29 21
 }
30
-

+ 5
- 2
man/formatRCTDataset.Rd View File

@@ -37,8 +37,11 @@ running VirtualTwins with interaction, it creates dummy variables.
37 37
 }
38 38
 \examples{
39 39
 \dontrun{
40
-data.format <- formatRCTDataset(data, "outcome", "treatment", TRUE)
41
-} 
40
+    data.format <- formatRCTDataset(data, "outcome", "treatment", TRUE)
41
+}
42
+data(sepsis)
43
+data.format <- formatRCTDataset(sepsis, "survival", "THERAPY", T)
44
+ 
42 45
 
43 46
  
44 47
   

+ 6
- 4
man/vt.data.Rd View File

@@ -27,9 +27,11 @@ interactions, set to TRUE (default value)}
27 27
 a VT.object object.
28 28
 }
29 29
 \examples{
30
-\dontrun{
31
- data(sepsis)
32
- formatRCTdataset(sepsis, "survival", "THERAPY", T)
33
-}
30
+
31
+data(sepsis)
32
+vt.o <- vt.data(sepsis, "survival", "THERAPY", T)
34 33
   
35 34
 }
35
+\seealso{
36
+\code{\link{formatRCTDataset}}
37
+}

+ 18
- 17
man/vt.forest.Rd View File

@@ -50,22 +50,23 @@ Is only used with forest.type = "fold". Default to 5. See
50 50
 parameter forest.type, any of these class can be used with its own parameter.
51 51
 }
52 52
 \examples{
53
-\dontrun{
54
- # data(sepsis)
55
- vt.o <- vt.data(sepsis, "survival", "THERAPY", T)
56
- # inside model : 
57
- vt.f <- vt.forest("one", vt.o)
58
- # ... 
59
- # your model : 
60
- rf <- randomForest(y = vt.o$getY(),
61
-                     x = vt.o$getX(int = T),
62
-                     mtry = 3,
63
-                     nodesize = 15)
64
- vt.f <- vt.forest("one", vt.o, model = rf)
65
- # ...
66
- # Can also use ... parameters
67
- vt.f <- vt.forest("one", vt.o, mtry = 3, nodesize = 15)
68
- # ...
69
-}   
53
+
54
+data(sepsis)
55
+vt.o <- vt.data(sepsis, "survival", "THERAPY", T)
56
+# inside model :
57
+vt.f <- vt.forest("one", vt.o)
58
+# ...
59
+# your model :
60
+# library(randomForest)
61
+# rf <- randomForest(y = vt.o$getY(),
62
+#                    x = vt.o$getX(int = T),
63
+#                    mtry = 3,
64
+#                    nodesize = 15)
65
+# vt.f <- vt.forest("one", vt.o, model = rf)
66
+# ...
67
+# Can also use ... parameters
68
+vt.f <- vt.forest("one", vt.o, mtry = 3, nodesize = 15)
69
+# ...
70
+   
70 71
 
71 72
 }

+ 10
- 12
man/vt.subgroups.Rd View File

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

+ 15
- 15
man/vt.tree.Rd View File

@@ -39,20 +39,20 @@ See \code{\link{VT.tree}}, \code{\link{VT.tree.class}} and
39 39
 \code{\link{VT.tree.reg}} classes.
40 40
 }
41 41
 \examples{
42
-\dontrun{
43
- # data(sepsis)
44
- vt.o <- vt.data(sepsis, "survival", "THERAPY", T)
45
- # inside model : 
46
- vt.f <- vt.forest("one", vt.o)
47
- # use classification tree
48
- vt.tr <- vt.tree("class", vt.f, threshold = c(0.01, 0.05))
49
- # return a list
50
- class(vt.tr)
51
- # access one of the tree
52
- vt.tr$tree1
53
- # return infos
54
- vt.tr$tree1$getInfos()
55
- # ...
56
-}
42
+data(sepsis)
43
+vt.o <- vt.data(sepsis, "survival", "THERAPY", T)
44
+# inside model :
45
+vt.f <- vt.forest("one", vt.o)
46
+# use classification tree
47
+vt.tr <- vt.tree("class", vt.f, threshold = c(0.01, 0.05))
48
+# return a list
49
+class(vt.tr)
50
+# access one of the tree
51
+tree1 <- vt.tr$tree1
52
+# return infos
53
+# vt.tr$tree1$getInfos()
54
+# vt.tr$tree1$getRules()
55
+# use vt.subgroups tool:
56
+subgroups <- vt.subgroups(vt.tr)
57 57
   
58 58
 }

Loading…
Cancel
Save