Skip to content

Commit

Permalink
Merge pull request #1 from mayer79/release_candidate
Browse files Browse the repository at this point in the history
release candidate ready
  • Loading branch information
mayer79 authored Jan 29, 2022
2 parents c0153b3 + 96df983 commit bd7f980
Show file tree
Hide file tree
Showing 94 changed files with 513 additions and 2,517 deletions.
10 changes: 8 additions & 2 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
^\.Rproj\.user$
^LICENSE\.md$
^cran-comments\.md$
^doc$
^Meta$
^confintr\.Rproj$
^packaging.R$
[.]Rproj$
^backlog$
^cran-comments.md$
^logo.png$
^.*\.Rproj$
^\.Rproj\.user$
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
.Ruserdata
doc
Meta
inst/doc
/doc/
/Meta/
35 changes: 17 additions & 18 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,38 +1,37 @@
Type: Package
Package: confintr
Title: Confidence Intervals
Version: 0.1.1
Date: 2020-06-29
Version: 0.1.2
Date: 2022-01-28
Authors@R:
person(given = "Michael",
family = "Mayer",
role = c("aut", "cre"),
email = "mayermichael79@gmail.com")
Maintainer: Michael Mayer <mayermichael79@gmail.com>
Description: Calculates classic and/or bootstrap confidence
intervals for many parameters such as the population mean, variance,
interquartile range (IQR), median absolute deviation (MAD), skewness,
kurtosis, Cramer's V, odds ratio, R-squared, quantiles (incl. median),
Description: Calculates classic and/or bootstrap confidence intervals for
many parameters such as the population mean, variance, interquartile
range (IQR), median absolute deviation (MAD), skewness, kurtosis,
Cramer's V, odds ratio, R-squared, quantiles (incl. median),
proportions, different types of correlation measures, difference in
means, quantiles and medians. Many of the classic confidence intervals
are described in Smithson, M. (2003, ISBN: 978-0761924999). Bootstrap
confidence intervals are calculated with the R package 'boot'. Both
one- and two-sided intervals are supported.
License: GPL(>= 2)
URL: https://github.com/mayer79/confintr
BugReports: https://github.com/mayer79/confintr/issues
License: GPL (>= 2)
Depends:
R (>= 3.1.0)
VignetteBuilder:
knitr
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.0
Imports:
stats,
boot
RoxygenNote: 7.1.1
URL: https://github.com/mayer79/confintr
BugReports: https://github.com/mayer79/confintr/issues
Suggests:
knitr,
rmarkdown,
testthat
knitr,
testthat (>= 3.0.0)
VignetteBuilder: knitr
Config/testthat/edition: 3
Imports:
boot,
stats
336 changes: 336 additions & 0 deletions LICENSE.md

Large diffs are not rendered by default.

File renamed without changes.
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# confintr 0.1.2

This is a maintenance release only,

- getting rid of the CRAN note on LazyData,
- updating to testthat v3, and
- using a more elegant way to generate/update the package.

# confintr 0.1.1

- Added confidence intervals for the odds ratio via stats::fisher.test.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ install.packages("confintr")
Latest version from github:
``` r
library(devtools)
install_github("mayer79/confintr", subdir = "release/confintr")
install_github("mayer79/confintr")
```

## Teaser
Expand Down
File renamed without changes.
32 changes: 32 additions & 0 deletions backlog/concordance.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
library(survival)
n <- 100
y <- sample(0:1, n, T)
x <- runif(n)
S <- Surv(rexp(n), sample(0:1, n, TRUE, prob = c(0.1, 0.9)))

conc_measure <- function(x, y, what = "AUC") {

conc <- survival::concordance(y ~ x)

if (what == "AUC") {
stopifnot(all(y == 1 | y == 0))
out <- conc$concordance
} else if (what == "SomersD") {
out <- conc$concordance * 2 - 1
} else if (what == "HarrellsC") {
stopifnot(is.Surv(y))
out <- conc$concordance
}
out
}

conc_measure(x, S, "HarrellsC")
Hmisc::rcorr.cens(x, S)

MetricsWeighted::AUC(y, x)

# AUC: y binary and default timewt
# Harrell's c-statistic: y survival
# (Somers' d + 1) / 2: y continuous
# var: somer / 4

28 changes: 24 additions & 4 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
## Resubmission
This is mainly a maintenance release:

- Resubmission reason: forgot rmarkdown package in suggests.
- removing testthat::context()
- getting rid of CRAN note on LazyData
- improving the way how the package itself is being generated.

- Fixed wrong "VignetteIndexEntry".
## Checks

- Added confidence intervals for the odds ratio via stats::fisher.test.
### Local check seems fine

`devtools::check()` result:

WARNING
'qpdf' is needed for checks on size reduction of PDFs

0 errors √ | 1 warning x | 0 notes √

### Online checks seem fine as well:

- check_win_devel()
- check_rhub()

checking for detritus in the temp directory ... NOTE
Found the following files/directories:
'lastMiKTeXException'

0 errors √ | 0 warnings √ | 1 note x
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file modified man/figures/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
136 changes: 63 additions & 73 deletions packaging.R
Original file line number Diff line number Diff line change
@@ -1,98 +1,88 @@
#=====================================================================================
# BUILD THE PACKAGE
#=====================================================================================
#=============================================================================
# Put together the package
#=============================================================================

if (FALSE) {
library(boot)
lapply(list.files("R", full.names = TRUE), source)
}
# WORKFLOW: UPDATE EXISTING PACKAGE
# 1) Modify package content and documentation.
# 2) Increase package number in "use_description" below.
# 3) Go through this script and carefully answer "no" if a "use_*" function
# asks to overwrite the existing files. Or just skip that function call.

library(usethis)
library(devtools)

# Create a new package
dir.create(file.path("release"))
pkg <- file.path("release", "confintr")

create_package(
pkg,
# Sketch of description file
use_description(
fields = list(
Title = "Confidence Intervals",
Type = "Package",
Version = "0.1.1",
Version = "0.1.2",
Date = Sys.Date(),
Description = "Calculates classic and/or bootstrap confidence intervals for many parameters such as the population mean, variance, interquartile range (IQR), median absolute deviation (MAD), skewness, kurtosis, Cramer's V, odds ratio, R-squared, quantiles (incl. median), proportions, different types of correlation measures, difference in means, quantiles and medians. Many of the classic confidence intervals are described in Smithson, M. (2003, ISBN: 978-0761924999). Bootstrap confidence intervals are calculated with the R package 'boot'. Both one- and two-sided intervals are supported.",
`Authors@R` = "person('Michael', 'Mayer', email = 'mayermichael79@gmail.com', role = c('aut', 'cre'))",
URL = "https://github.com/mayer79/confintr",
BugReports = "https://github.com/mayer79/confintr/issues",
Depends = "R (>= 3.1.0)",
VignetteBuilder = "knitr",
License = "GPL(>= 2)",
LazyData = NULL,
Maintainer = "Michael Mayer <mayermichael79@gmail.com>"),
open = FALSE)
Maintainer = "Michael Mayer <mayermichael79@gmail.com>"
),
roxygen = TRUE
)

use_gpl_license(2)
use_github_links() # use this if this project is on github

file.copy(file.path(pkg, "DESCRIPTION"), to = getwd(), overwrite = TRUE)
# Use package has no option to look for pkg, so we first copy description from pkg, modify it and move back
# Your files that do not belong to the package itself (others are added by "use_* function")
use_build_ignore(c("^packaging.R$", "[.]Rproj$", "^backlog$",
"^cran-comments.md$", "^logo.png$"), escape = FALSE)

# Required external packages
use_package("stats", "Imports")
use_package("boot", "Imports")
use_package("knitr", "Suggests")
use_package("rmarkdown", "Suggests")
use_package("testthat", "Suggests")

# Set up other files -------------------------------------------------
# use_readme_md()
# use_news_md()
# use_cran_comments()
# use_testthat()

# Copy readme etc.
file.copy(c("NEWS.md", "README.md", "cran-comments.md", "DESCRIPTION", ".Rbuildignore"),
pkg, overwrite = TRUE)

# Copy R scripts and document them
if (!dir.exists(file.path(pkg, "R"))) {
dir.create(file.path(pkg, "R"))
}
file.copy(list.files("R", full.names = TRUE), file.path(pkg, "R"), overwrite = TRUE)
devtools::document(pkg)

# Tests
if (!dir.exists(file.path(pkg, "tests"))) {
dir.create(file.path(pkg, "tests"))
}
file.copy("tests", pkg, recursive = TRUE)
# test(pkg)
# If your code uses the pipe operator %>%
# use_pipe()

# If your package contains data. Google how to document
# use_data()

# Add short docu in Markdown (without running R code)
use_readme_md()

# Longer docu in RMarkdown (with running R code). Often quite similar to readme.
use_vignette("confintr")

# If you want to add unit tests
use_testthat()
# use_test("test-cor.R")

# On top of NEWS.md, describe changes made to the package
use_news_md()

# Add logo
use_logo("logo.png")
dir.create(file.path(pkg, "man", "figures"))
file.copy(file.path("man", "figures", "logo.png"),
file.path(pkg, "man", "figures", "logo.png"))

if (TRUE) {
# Copy vignette
# use_vignette(name = "confintr", title = "confintr")
dir.create(file.path(pkg, "vignettes"))
dir.create(file.path(pkg, "doc"))
dir.create(file.path(pkg, "Meta"))
file.copy(list.files("vignettes", full.names = TRUE),
file.path(pkg, "vignettes"), overwrite = TRUE)

devtools::build_vignettes(pkg)
}

# Check
check(pkg, manual = TRUE)
# If package goes to CRAN: infos (check results etc.) for CRAN
use_cran_comments()

# Create
build(pkg)

# Install
install(pkg)
#=============================================================================
# Finish package building (can use fresh session)
#=============================================================================

check_win_devel(pkg)
library(devtools)

document()
test()
build_vignettes()
check(manual = TRUE, cran = TRUE)
build()
# build(binary = TRUE)
install()

check_rhub(pkg)
# Run only if package is public(!) and should go to CRAN
if (FALSE) {
check_win_devel()
check_rhub()

devtools::release(pkg)
# Wait until above checks are passed without relevant notes/warnings
# then submit to CRAN
release()
}
5 changes: 0 additions & 5 deletions release/confintr/.Rbuildignore

This file was deleted.

1 change: 0 additions & 1 deletion release/confintr/.gitignore

This file was deleted.

38 changes: 0 additions & 38 deletions release/confintr/DESCRIPTION

This file was deleted.

9 changes: 0 additions & 9 deletions release/confintr/NEWS.md

This file was deleted.

Loading

0 comments on commit bd7f980

Please sign in to comment.