Skip to content

Commit

Permalink
Merge pull request #16 from kaigu1990/mcr_removed
Browse files Browse the repository at this point in the history
Remove mcr related codes as a temporary solution #15
  • Loading branch information
kaigu1990 authored Sep 25, 2023
2 parents d961099 + 66b5821 commit 70e7789
Show file tree
Hide file tree
Showing 25 changed files with 162 additions and 821 deletions.
1 change: 0 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ Imports:
Suggests:
dplyr,
knitr,
mcr,
rmarkdown,
spelling,
testthat (>= 3.0.0),
Expand Down
5 changes: 0 additions & 5 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,18 @@ export(VCAinference)
export(anovaVCA)
export(aucTest)
export(blandAltman)
export(calcBias)
export(cat_with_newline)
export(diagTab)
export(dixon_outlier)
export(esd.critical)
export(getCoefficients)
export(h_difference)
export(h_factor)
export(h_fmt_est)
export(h_fmt_num)
export(h_fmt_range)
export(h_summarize)
export(mcreg)
export(mcreg2)
export(nonparRI)
export(pearsonTest)
export(printSummary)
export(refInterval)
export(robustRI)
export(size_ci_corr)
Expand Down
24 changes: 10 additions & 14 deletions R/autoplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#' default is FALSE.
#' @param loa.line (`logical`)\cr whether to plot limit of agreement line, default is TRUE.
#' @param ref.line.params,ci.line.params,loa.line.params (`list`)\cr parameters
#' (color, linetype, size) for the argument 'ref.line', 'ci.line' and 'loa.line';
#' eg. ref.line.params = list(col = "blue", linetype = "solid", size = 1).
#' (color, linetype, linewidth) for the argument 'ref.line', 'ci.line' and 'loa.line';
#' eg. ref.line.params = list(col = "blue", linetype = "solid", linewidth = 1).
#' @param label (`logical`)\cr whether to add specific value label for each line
#' (ref.line, ci.line and loa.line). Only be shown when the line is defined as TRUE.
#' @param label.digits (`integer`)\cr the number of digits after the decimal point
Expand All @@ -29,16 +29,10 @@
#' @export
#'
#' @examples
#' # Using creatinine dataset from `mcr` package
#' data(creatinine, package = "mcr")
#' object <- blandAltman(x = creatinine$serum.crea, y = creatinine$plasma.crea)
#' autoplot(object)
#' autoplot(object, type = "relative")
#'
#' # Specify the type for difference plot
#' data("platelet")
#' object <- blandAltman(x = platelet$Comparative, y = platelet$Candidate)
#' autoplot(object, type = "absolute")
#' autoplot(object)
#' autoplot(object, type = "relative")
#'
#' # Set the addition parameters for `geom_point`
Expand Down Expand Up @@ -182,7 +176,7 @@ setMethod(
yintercept = statmat["mean"],
col = if (is.null(ref.line.params[["col"]])) 1 else ref.line.params[["col"]],
linetype = if (is.null(ref.line.params[["linetype"]])) 1 else ref.line.params[["linetype"]],
size = if (is.null(ref.line.params[["size"]])) 0.9 else ref.line.params[["size"]]
linewidth = if (is.null(ref.line.params[["linewidth"]])) 0.9 else ref.line.params[["linewidth"]]
)

if (label) {
Expand All @@ -203,13 +197,13 @@ setMethod(
yintercept = statmat["ci_lr"],
col = if (is.null(ci.line.params[["col"]])) 1 else ci.line.params[["col"]],
linetype = if (is.null(ci.line.params[["linetype"]])) 1 else ci.line.params[["linetype"]],
size = if (is.null(ci.line.params[["size"]])) 0.8 else ci.line.params[["size"]]
linewidth = if (is.null(ci.line.params[["linewidth"]])) 0.8 else ci.line.params[["size"]]
) +
geom_hline(
yintercept = statmat["ci_ur"],
col = if (is.null(ci.line.params[["col"]])) 1 else ci.line.params[["col"]],
linetype = if (is.null(ci.line.params[["linetype"]])) 1 else ci.line.params[["linetype"]],
size = if (is.null(ci.line.params[["size"]])) 0.8 else ci.line.params[["size"]]
linewidth = if (is.null(ci.line.params[["linewidth"]])) 0.8 else ci.line.params[["linewidth"]]
)

if (label) {
Expand Down Expand Up @@ -237,13 +231,13 @@ setMethod(
yintercept = statmat["limit_lr"],
col = if (is.null(loa.line.params[["col"]])) 1 else loa.line.params[["col"]],
linetype = if (is.null(loa.line.params[["linetype"]])) 1 else loa.line.params[["linetype"]],
size = if (is.null(loa.line.params[["size"]])) 0.8 else loa.line.params[["size"]]
linewidth = if (is.null(loa.line.params[["linewidth"]])) 0.8 else loa.line.params[["linewidth"]]
) +
geom_hline(
yintercept = statmat["limit_ur"],
col = if (is.null(loa.line.params[["col"]])) 1 else loa.line.params[["col"]],
linetype = if (is.null(loa.line.params[["linetype"]])) 1 else loa.line.params[["linetype"]],
size = if (is.null(loa.line.params[["size"]])) 0.8 else loa.line.params[["size"]]
linewidth = if (is.null(loa.line.params[["linewidth"]])) 0.8 else loa.line.params[["linewidth"]]
)

if (label) {
Expand Down Expand Up @@ -308,6 +302,7 @@ setMethod(
#' @export
#'
#' @examples
#' \dontrun{
#' # Using the default arguments for regression plot
#' data("platelet")
#' fit <- mcreg2(
Expand All @@ -323,6 +318,7 @@ setMethod(
#' legend.title = FALSE,
#' legend.digits = 4
#' )
#' }
setMethod(
f = "autoplot",
signature = c("MCR"),
Expand Down
47 changes: 21 additions & 26 deletions R/mcr.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@
#' method.reg = "Deming", method.ci = "jackknife"
#' )
#' printSummary(fit)
printSummary <- function(...) {
mcr::printSummary(...)
}


# printSummary <- function(...) {
# mcr::printSummary(...)
# }
# getCoefficients ----

#' Get Regression Coefficients
Expand All @@ -39,11 +37,9 @@ printSummary <- function(...) {
#' method.reg = "Deming", method.ci = "jackknife"
#' )
#' getCoefficients(fit)
getCoefficients <- function(...) {
mcr::getCoefficients(...)
}


# getCoefficients <- function(...) {
# mcr::getCoefficients(...)
# }
# mcreg ----

#' Comparison of Two Measurement Methods Using Regression Analysis
Expand All @@ -65,9 +61,9 @@ getCoefficients <- function(...) {
#' )
#' printSummary(fit)
#' getCoefficients(fit)
mcreg <- function(...) {
mcr::mcreg(...)
}
# mcreg <- function(...) {
# mcr::mcreg(...)
# }

#' @rdname mcreg
#' @aliases mcreg
Expand All @@ -80,16 +76,15 @@ mcreg <- function(...) {
#' x = platelet$Comparative, y = platelet$Candidate,
#' method.reg = "Deming", method.ci = "jackknife"
#' )
mcreg2 <- function(...) {
fit <- mcr::mcreg(...)
MCR(
data = fit@data,
coef = fit@glob.coef,
mnames = fit@mnames,
regmeth = fit@regmeth
)
}

# mcreg2 <- function(...) {
# fit <- mcr::mcreg(...)
# MCR(
# data = fit@data,
# coef = fit@glob.coef,
# mnames = fit@mnames,
# regmeth = fit@regmeth
# )
# }
# calcBias ----

#' Systematical Bias Between Reference Method and Test Method
Expand All @@ -114,6 +109,6 @@ mcreg2 <- function(...) {
#' calcBias(fit, x.levels = c(30, 200))
#' calcBias(fit, x.levels = c(30, 200), type = "proportional")
#' calcBias(fit, x.levels = c(30, 200), type = "proportional", percent = FALSE)
calcBias <- function(...) {
mcr::calcBias(...)
}
# calcBias <- function(...) {
# mcr::calcBias(...)
# }
7 changes: 3 additions & 4 deletions R/pkg_methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ setMethod(
#' @examples
#'
#' # Bland-Altman analysis
#' data("creatinine", package = "mcr")
#' blandAltman(x = creatinine$serum.crea, y = creatinine$plasma.crea)
#' data("platelet")
#' blandAltman(x = platelet$Comparative, y = platelet$Candidate)
setMethod(
f = "show",
signature = "BAsummary",
Expand Down Expand Up @@ -257,8 +257,7 @@ setGeneric("getOutlier", function(object, ...) standardGeneric("getOutlier"))
#' getOutlier(ba3, method = "ESD", difference = "rel")
#'
#' # Using "4E" as the method input
#' data("creatinine", package = "mcr")
#' ba4 <- blandAltman(x = creatinine$serum.crea, y = creatinine$plasma.crea)
#' ba4 <- blandAltman(x = platelet$Comparative, y = platelet$Candidate)
#' getOutlier(ba4, method = "4E")
setMethod(
f = "getOutlier",
Expand Down
2 changes: 1 addition & 1 deletion R/referenceInterval.R
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ nonparRI <- function(x, ind = 1:length(x), conf.level = 0.95) {
#' x <- calcium$Value
#' refInterval(x, RI_method = "parametric", CI_method = "parametric")
#' refInterval(x, RI_method = "nonparametric", CI_method = "nonparametric")
#' refInterval(x, RI_method = "robust", CI_method = "boot")
#' refInterval(x, RI_method = "robust", CI_method = "boot", R = 1000)
refInterval <- function(x, out_method = c("doxin", "tukey"),
out_rm = FALSE,
RI_method = c("parametric", "nonparametric", "robust"),
Expand Down
4 changes: 0 additions & 4 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ reference:
- size_ci_corr
- diagTab
- blandAltman
- mcreg
- printSummary
- getCoefficients
- calcBias
- pearsonTest
- spearmanTest
- ESD_test
Expand Down
8 changes: 6 additions & 2 deletions cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@

0 errors | 0 warnings | 1 note

Maintainer: 'Kai Gu <gukai1212@163.com>'

New submission

* This is a new release.
* Suggests or Enhances not in mainstream repositories: `mcr`. Because `mcr` package
is not available in CRAN. But users can install it from archived version.
* As `mcr` package is not available in CRAN for now, I add not running statement
for the examples. But users can install it from archived version.

## revdepcheck results

Expand Down
11 changes: 1 addition & 10 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,18 @@ Jen
LDL
Liu
LoA
MCResult
MCTab
MMEs
McCulloch
NBins
NCSS
NMPA
NMPA's
NOBOUND
NSCLC
Newcombe
OxLDL
PBequi
PDL
PROC
PaBa
PaBaLarge
QC'ed
RandomEffects
Reproducibility
Expand All @@ -51,7 +46,6 @@ SampleSize
Satterthwaite
Searle
Statist
Theil
VC
VCA
VCoriginal
Expand All @@ -70,14 +64,14 @@ confInt
creatinin
dL
eg
equivariant
et
fontface
gb
ggplot
immunohistochemical
ixed
linetype
linewidth
lipoprotein
loa
magrittr
Expand All @@ -95,15 +89,12 @@ pearson
plr
ppa
ppv
quasilinear
quations
refInt
refROC
regmeth
regmethod
repo
reproducibility
rng
roxygen
sas
satterthwaite
Expand Down
14 changes: 5 additions & 9 deletions man/autoplot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 70e7789

Please sign in to comment.