Skip to content

Commit 387a123

Browse files
authored
Merge pull request #1 from InsightRX/RXR-2949
RXR-2949: Clean up package
2 parents e0a53ee + 488c79f commit 387a123

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1470
-538
lines changed

.Rbuildignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
^.*\.Rproj$
2+
^\.Rproj\.user$
3+
^README\.Rmd$
4+
^codecov\.yml$
5+
^\.github$
6+
^_pkgdown\.yml$
7+
^docs$
8+
^pkgdown$
9+
^LICENSE\.md$

.github/workflows/pkgdown.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
release:
8+
types: [published]
9+
workflow_dispatch:
10+
11+
name: pkgdown.yaml
12+
13+
permissions: read-all
14+
15+
jobs:
16+
pkgdown:
17+
runs-on: ubuntu-latest
18+
# Only restrict concurrency for non-PR jobs
19+
concurrency:
20+
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
21+
env:
22+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
23+
permissions:
24+
contents: write
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- uses: r-lib/actions/setup-pandoc@v2
29+
30+
- uses: r-lib/actions/setup-r@v2
31+
with:
32+
use-public-rspm: true
33+
34+
- uses: r-lib/actions/setup-r-dependencies@v2
35+
with:
36+
extra-packages: any::pkgdown, local::.
37+
needs: website
38+
39+
- name: Build site
40+
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
41+
shell: Rscript {0}
42+
43+
- name: Deploy to GitHub pages 🚀
44+
if: github.event_name != 'pull_request'
45+
uses: JamesIves/[email protected]
46+
with:
47+
clean: false
48+
branch: gh-pages
49+
folder: docs
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
8+
name: test-coverage.yaml
9+
10+
permissions: read-all
11+
12+
jobs:
13+
test-coverage:
14+
runs-on: ubuntu-latest
15+
env:
16+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- uses: r-lib/actions/setup-r@v2
22+
with:
23+
use-public-rspm: true
24+
25+
- uses: r-lib/actions/setup-r-dependencies@v2
26+
with:
27+
extra-packages: any::covr, any::xml2
28+
needs: coverage
29+
30+
- name: Test coverage
31+
run: |
32+
cov <- covr::package_coverage(
33+
quiet = FALSE,
34+
clean = FALSE,
35+
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
36+
)
37+
print(cov)
38+
covr::to_cobertura(cov)
39+
shell: Rscript {0}
40+
41+
- uses: codecov/codecov-action@v5
42+
with:
43+
# Fail if error if not on PR, or if on PR and token is given
44+
fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }}
45+
files: ./cobertura.xml
46+
plugins: noop
47+
disable_search: true
48+
token: ${{ secrets.CODECOV_TOKEN }}
49+
50+
- name: Show testthat output
51+
if: always()
52+
run: |
53+
## --------------------------------------------------------------------
54+
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
55+
shell: bash
56+
57+
- name: Upload test results
58+
if: failure()
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: coverage-test-failures
62+
path: ${{ runner.temp }}/package

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
.Rhistory
44
.RData
55
.Ruserdata
6+
docs

DESCRIPTION

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,33 @@ Title: Forging data for pharmacometric analyses
33
Version: 0.0.0.9000
44
Authors@R: c(
55
person("Ron", "Keizer", email = "[email protected]", role = c("cre", "aut")),
6+
person("Michael", "McCarthy", email = "[email protected]", role = "ctb"),
67
person("InsightRX", role = "cph")
78
)
8-
Author: Ron Keizer
9-
Maintainer: Ron Keizer <[email protected]>
109
Description: Functions for parsing, converting, and generating data for pharmacometric analyses.
10+
License: MIT + file LICENSE
11+
Depends:
12+
R (>= 3.5)
1113
Imports:
14+
admiral,
1215
dplyr,
16+
irxutils,
1317
lubridate,
18+
mice (>= 3.7.5),
19+
mvtnorm,
1420
rlang,
1521
stringr,
22+
tibble,
1623
tidyr,
17-
jsonlite,
18-
irxutils
24+
tidyselect
1925
Suggests:
2026
testthat (>= 3.2.0),
2127
withr
22-
License: file LICENSE
28+
Remotes:
29+
InsightRX/irxutils
30+
Config/testthat/edition: 3
2331
Encoding: UTF-8
32+
LazyData: true
2433
Roxygen: list(markdown = TRUE)
2534
RoxygenNote: 7.3.3
26-
Config/testthat/edition: 3
27-
Depends:
28-
R (>= 3.5)
29-
LazyData: true
35+
URL: https://insightrx.github.io/irxforge/

LICENSE

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
Copyright 2023 InsightRX. All rights reserved.
1+
YEAR: 2025
2+
COPYRIGHT HOLDER: InsightRX

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# MIT License
2+
3+
Copyright (c) 2025 InsightRX
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

NAMESPACE

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
export(add_nominal_timepoints)
44
export(create_demographics_table)
5-
export(get_data_for_modelfit)
6-
export(get_data_for_nca)
75
export(get_nominal_timepoints)
86
export(get_route_from_data_column)
97
export(reformat_data)

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# irxforge (development version)
2+
3+
* Initial CRAN submission.

R/add_nominal_timepoints.R

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,27 @@
33
#' @param data `data.frame` or `tibble` with at least a time column
44
#' @param time_var variable name for time vector in dataset
55
#' @param nominal_time_var variable name for new nominal time vector
6-
#' @param ... passed as argument to `get_nominal_timepoints()` and
7-
#' to `stats::density()`.
6+
#' @param verbose Logical.
7+
#' @param ... passed as argument to [get_nominal_timepoints()] and to
8+
#' `stats::density()`.
89
#'
910
#' @returns data.frame or tibble
11+
#'
12+
#' @seealso [get_nominal_timepoints()]
1013
#'
1114
#' @export
1215
add_nominal_timepoints <- function(
13-
data,
14-
time_var = "time",
15-
nominal_time_var = "NOMINAL_TIME",
16-
verbose = FALSE,
17-
...
16+
data,
17+
time_var = "time",
18+
nominal_time_var = "NOMINAL_TIME",
19+
verbose = FALSE,
20+
...
1821
) {
19-
t_nom <- get_nominal_timepoints(
20-
data[[time_var]],
21-
...
22-
)
22+
rlang::check_dots_used()
23+
t_nom <- get_nominal_timepoints(data[[time_var]], ...)
2324
if(verbose) {
2425
message("Nominal times identified: ", paste0(t_nom, collapse=", "))
2526
}
2627
data[[nominal_time_var]] <- t_nom[match.closest(data[[time_var]], t_nom)]
2728
data
2829
}
29-
30-
match.closest <- function(x, y) {
31-
cuts <- c(-Inf, y[-1] - diff(y)/2, Inf)
32-
idx <- findInterval(x, cuts)
33-
}

0 commit comments

Comments
 (0)