Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
^.*\.Rproj$
^\.Rproj\.user$
^README\.Rmd$
^codecov\.yml$
^\.github$
^_pkgdown\.yml$
^docs$
^pkgdown$
^LICENSE\.md$
49 changes: 49 additions & 0 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
release:
types: [published]
workflow_dispatch:

name: pkgdown.yaml

permissions: read-all

jobs:
pkgdown:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::.
needs: website

- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/[email protected]
with:
clean: false
branch: gh-pages
folder: docs
62 changes: 62 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:

name: test-coverage.yaml

permissions: read-all

jobs:
test-coverage:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::covr, any::xml2
needs: coverage

- name: Test coverage
run: |
cov <- covr::package_coverage(
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
print(cov)
covr::to_cobertura(cov)
shell: Rscript {0}

- uses: codecov/codecov-action@v5
with:
# Fail if error if not on PR, or if on PR and token is given
fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }}
files: ./cobertura.xml
plugins: noop
disable_search: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: Show testthat output
if: always()
run: |
## --------------------------------------------------------------------
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
.Rhistory
.RData
.Ruserdata
docs
24 changes: 15 additions & 9 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,33 @@ Title: Forging data for pharmacometric analyses
Version: 0.0.0.9000
Authors@R: c(
person("Ron", "Keizer", email = "[email protected]", role = c("cre", "aut")),
person("Michael", "McCarthy", email = "[email protected]", role = "ctb"),
person("InsightRX", role = "cph")
)
Author: Ron Keizer
Maintainer: Ron Keizer <[email protected]>
Description: Functions for parsing, converting, and generating data for pharmacometric analyses.
License: MIT + file LICENSE
Depends:
R (>= 3.5)
Imports:
admiral,
dplyr,
irxutils,
lubridate,
mice (>= 3.7.5),
mvtnorm,
rlang,
stringr,
tibble,
tidyr,
jsonlite,
irxutils
tidyselect
Suggests:
testthat (>= 3.2.0),
withr
License: file LICENSE
Remotes:
InsightRX/irxutils
Config/testthat/edition: 3
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.3
Config/testthat/edition: 3
Depends:
R (>= 3.5)
LazyData: true
URL: https://insightrx.github.io/irxforge/
3 changes: 2 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Copyright 2023 InsightRX. All rights reserved.
YEAR: 2025
COPYRIGHT HOLDER: InsightRX
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# MIT License

Copyright (c) 2025 InsightRX

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 0 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

export(add_nominal_timepoints)
export(create_demographics_table)
export(get_data_for_modelfit)
export(get_data_for_nca)
export(get_nominal_timepoints)
export(get_route_from_data_column)
export(reformat_data)
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# irxforge (development version)

* Initial CRAN submission.
28 changes: 12 additions & 16 deletions R/add_nominal_timepoints.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,27 @@
#' @param data `data.frame` or `tibble` with at least a time column
#' @param time_var variable name for time vector in dataset
#' @param nominal_time_var variable name for new nominal time vector
#' @param ... passed as argument to `get_nominal_timepoints()` and
#' to `stats::density()`.
#' @param verbose Logical.
#' @param ... passed as argument to [get_nominal_timepoints()] and to
#' `stats::density()`.
#'
#' @returns data.frame or tibble
#'
#' @seealso [get_nominal_timepoints()]
#'
#' @export
add_nominal_timepoints <- function(
data,
time_var = "time",
nominal_time_var = "NOMINAL_TIME",
verbose = FALSE,
...
data,
time_var = "time",
nominal_time_var = "NOMINAL_TIME",
verbose = FALSE,
...
) {
t_nom <- get_nominal_timepoints(
data[[time_var]],
...
)
rlang::check_dots_used()
t_nom <- get_nominal_timepoints(data[[time_var]], ...)
if(verbose) {
message("Nominal times identified: ", paste0(t_nom, collapse=", "))
}
data[[nominal_time_var]] <- t_nom[match.closest(data[[time_var]], t_nom)]
data
}

match.closest <- function(x, y) {
cuts <- c(-Inf, y[-1] - diff(y)/2, Inf)
idx <- findInterval(x, cuts)
}
Loading