mirror of
https://github.com/prise6/aVirtualTwins.git
synced 2024-05-16 21:56:32 +02:00
New method in VT.object
This commit is contained in:
parent
79cc1ecf07
commit
cc4cfaf720
22
R/object.R
22
R/object.R
|
@ -101,6 +101,17 @@ VT.object <- setRefClass(
|
||||||
return(data.frame(cbind(.self$data[,-1], tmp*.self$data[, 2], tmp*(1 - .self$data[, 2]))))
|
return(data.frame(cbind(.self$data[,-1], tmp*.self$data[, 2], tmp*(1 - .self$data[, 2]))))
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getData = function(interactions = F){
|
||||||
|
"Return dataset. If interactions is set to T, return data with treatement interactions"
|
||||||
|
if(!isTRUE(interactions))
|
||||||
|
return(.self$data)
|
||||||
|
else{
|
||||||
|
data.int <- cbind(.self$data[, 1], .self$getX(T))
|
||||||
|
colnames(data.int)[1] <- colnames(.self$data)[1]
|
||||||
|
return(data.int)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
switchTreatment = function(){
|
switchTreatment = function(){
|
||||||
"Switch treatment value."
|
"Switch treatment value."
|
||||||
cl <- class(.self$data[, 2])
|
cl <- class(.self$data[, 2])
|
||||||
|
@ -127,9 +138,14 @@ VT.object <- setRefClass(
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getIncidences = function(){
|
# Hack of VT.incidences
|
||||||
"Return incidence table of data."
|
getIncidences = function(rule = NULL){
|
||||||
return(vt.getIncidence(.self$data))
|
"Return incidence table of data if rule set to NULL. Otherwise return incidence for the rule."
|
||||||
|
hack.difft <- VT.difft$new(.self)
|
||||||
|
if(is.null(rule))
|
||||||
|
return(vt.getIncidence(.self$data))
|
||||||
|
else
|
||||||
|
return(VT.incidences(hack.difft, rule, F))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue