|
|
@@ -240,7 +240,7 @@ simple.plotROC<-function(df,var,col="black",x=0.65,y=0.1,unit="ml",precise=FALSE
|
|
|
#'@param cols vector of color names
|
|
|
#'@param x coordinate for legend
|
|
|
#'@param y coordinate for legend
|
|
|
-#'@param unit unit for threshold in labels
|
|
|
+#'@param units units for threshold in labels
|
|
|
#'@param precise number of decimal places to use when reporting opt threshold, TRUE:2, FALSE:0
|
|
|
#'@param target column that holds binary outcomes
|
|
|
#'
|
|
|
@@ -248,7 +248,7 @@ simple.plotROC<-function(df,var,col="black",x=0.65,y=0.1,unit="ml",precise=FALSE
|
|
|
#'
|
|
|
#'@export
|
|
|
|
|
|
-simple.plotROCgg<-function(df,vars,cols,x=0.7,y=0.3,unit="ml",precise="FALSE",target="alive"){
|
|
|
+simple.plotROCgg<-function(df,vars,cols,x=0.7,y=0.3,units=c(),precise="FALSE",target="alive"){
|
|
|
if (!requireNamespace('ggplot2',quiet=TRUE)){
|
|
|
print('ggplot2 not available. Use simple.plotROC function')
|
|
|
return(NULL)
|
|
|
@@ -257,10 +257,16 @@ simple.plotROCgg<-function(df,vars,cols,x=0.7,y=0.3,unit="ml",precise="FALSE",ta
|
|
|
#ggplot alternative
|
|
|
cvalues<-base::c()
|
|
|
colors_used<-base::c()
|
|
|
-
|
|
|
+ if (base::length(units)==0){
|
|
|
+ units=base::rep('',base::length(vars))
|
|
|
+ }
|
|
|
i=1
|
|
|
g<-ggplot2::ggplot()
|
|
|
- for (var in vars) {
|
|
|
+ #sdf<-data.frame(var=vars,unit=units)
|
|
|
+
|
|
|
+ for (i in 1:length(vars)) {
|
|
|
+ var=vars[i]
|
|
|
+ unit=units[i]
|
|
|
if (var %in% base::names(df)) {
|
|
|
# Pred izračunom ROC odstranimo vrstice z NA vrednostmi
|
|
|
df<-mapNA(df,var,0)
|