diff --git a/R/vpcstats_fun.R b/R/vpcstats_fun.R index ce515b6..57b51f2 100644 --- a/R/vpcstats_fun.R +++ b/R/vpcstats_fun.R @@ -34,7 +34,7 @@ vpcstats.tidyvpcobj <- function(o, vpc.type =c("continuous", "categorical"), qpr "A binning method should be specified through binning() or binless() execution before vpcstats() run." ) } - + stopifnot(length(qpred) == 3) repl <- ypc <- ypcvc <- y <- x <- blq <- lloq <- alq <- uloq <- NULL @@ -61,8 +61,8 @@ vpcstats.tidyvpcobj <- function(o, vpc.type =c("continuous", "categorical"), qpr ylvls <- sort(unique(obs$y)) - # categorical binless vpcstats() ---- if(method$method == "binless"){ + # categorical binless vpcstats() ---- xobs <- obs$x xsim <- sim$x sp <- method$sp @@ -153,7 +153,7 @@ vpcstats.tidyvpcobj <- function(o, vpc.type =c("continuous", "categorical"), qpr stop("Need to specify binning before calling vpcstats.") } if (any(is.na(stratbin$bin))) { - warning("There are bins missing. Has binning been specified for all strata?", call.=F) + warning("There are bins missing. Has binning been specified for all strata?", call.=FALSE) } .stratbinrepl <- data.table(stratbin, sim[, .(repl)]) @@ -187,8 +187,8 @@ vpcstats.tidyvpcobj <- function(o, vpc.type =c("continuous", "categorical"), qpr } # update vpc update(o, stats=stats, conf.level=conf.level, vpc.type = type, vpc.method = method) - # continuous vpcstats ---- } else { + # continuous vpcstats ---- if(method$method == "binless") { .binlessvpcstats(o, qpred=qpred, conf.level=conf.level, quantile.type=quantile.type, vpc.type = type, vpc.method = method) } else { @@ -204,14 +204,14 @@ vpcstats.tidyvpcobj <- function(o, vpc.type =c("continuous", "categorical"), qpr if (isTRUE(predcor)) { if (isTRUE(varcorr)) { - qobs <- obs[, quant_loq(ypcvc, probs=qpred, blq=blq, alq=alq, type = quantile.type), by=stratbin] + qobs <- obs[, quant_loq(ypcvc, probs=qpred, blq=blq, alq=alq, type = quantile.type), by=stratbin] qsim <- sim[, quant_loq(ypcvc, probs=qpred, blq=FALSE, alq=FALSE, type = quantile.type), by=.stratbinrepl] } else { - qobs <- obs[, quant_loq(ypc, probs=qpred, blq=blq, alq=alq, type = quantile.type), by=stratbin] + qobs <- obs[, quant_loq(ypc, probs=qpred, blq=blq, alq=alq, type = quantile.type), by=stratbin] qsim <- sim[, quant_loq(ypc, probs=qpred, blq=FALSE, alq=FALSE, type = quantile.type), by=.stratbinrepl] } } else { - qobs <- obs[, quant_loq(y, probs=qpred, blq=blq, alq=alq , type = quantile.type), by=stratbin] + qobs <- obs[, quant_loq(y, probs=qpred, blq=blq, alq=alq, type = quantile.type), by=stratbin] qsim <- sim[, quant_loq(y, probs=qpred, blq=FALSE, alq=FALSE, type = quantile.type), by=.stratbinrepl] }