diff --git a/DESCRIPTION b/DESCRIPTION index 226096a..b534adf 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -7,7 +7,9 @@ Description: Tools for Danish health research. A collection of functions to ease my work. I'll try to keep it updated for others to use as well. Depends: R (>= 3.4.4) -Imports: broom +Imports: broom, + dplyr, + epiR License: GPL (>= 2) Encoding: UTF-8 LazyData: true diff --git a/NAMESPACE b/NAMESPACE index 7385056..4b21f71 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -12,5 +12,6 @@ export(hwe_allele) export(hwe_geno) export(hwe_sum) export(rep_biv) +export(rep_epi_tests) export(rep_glm) export(rep_lm) diff --git a/R/rep_epi_tests.R b/R/rep_epi_tests.R new file mode 100644 index 0000000..c3a0e19 --- /dev/null +++ b/R/rep_epi_tests.R @@ -0,0 +1,24 @@ +#' A repeated epi.tests function +#' +#' Repeats the epi.tests from the epiR package. +#' @description For bivariate analyses. The confint() function is rather slow, causing the whole function to hang when including many predictors and calculating the ORs with CI. +#' @param gs the test or meassure used as "golden standard". Format as dichotomised factor. +#' @param test possible predictive tests to evaluate. Format as dichotomised factor. +#' @keywords ppv npv sensitivity specificity +#' @export +#' @examples +#' rep_epi_tests() + + +rep_epi_tests<-function(gs,test){ + require(epiR) + + ls<-list() + for (i in 1:ncol(test)){ + t<-table(test[,i],gs) + rval <- epi.tests(t, conf.level = 0.95) + n<-names(test)[i] + ls[[i]]<-list(n,rval) + } + return(ls) +} diff --git a/man/rep_epi_tests.Rd b/man/rep_epi_tests.Rd new file mode 100644 index 0000000..3eb4d2a --- /dev/null +++ b/man/rep_epi_tests.Rd @@ -0,0 +1,26 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/rep_epi_tests.R +\name{rep_epi_tests} +\alias{rep_epi_tests} +\title{A repeated epi.tests function} +\usage{ +rep_epi_tests(gs, test) +} +\arguments{ +\item{gs}{the test or meassure used as "golden standard". Format as dichotomised factor.} + +\item{test}{possible predictive tests to evaluate. Format as dichotomised factor.} +} +\description{ +For bivariate analyses. The confint() function is rather slow, causing the whole function to hang when including many predictors and calculating the ORs with CI. +} +\details{ +Repeats the epi.tests from the epiR package. +} +\examples{ +rep_epi_tests() +} +\keyword{npv} +\keyword{ppv} +\keyword{sensitivity} +\keyword{specificity}