- using R version 4.5.2 Patched (2026-01-31 r89382)
- using platform: aarch64-apple-darwin20
- R was compiled by
Apple clang version 16.0.0 (clang-1600.0.26.6)
GNU Fortran (GCC) 14.2.0
- running under: macOS Ventura 13.7.8
- using session charset: UTF-8
- checking for file ‘heaven/DESCRIPTION’ ... OK
- checking extension type ... Package
- this is package ‘heaven’ version ‘2026.10.30’
- package encoding: UTF-8
- checking package namespace information ... OK
- checking package dependencies ... OK
- checking if this is a source package ... OK
- checking if there is a namespace ... OK
- checking for executable files ... OK
- checking for hidden files and directories ... OK
- checking for portable file names ... OK
- checking for sufficient/correct file permissions ... OK
- checking whether package ‘heaven’ can be installed ... [20s/7s] OK
See the install log for details.
- used C++ compiler: ‘Apple clang version 14.0.3 (clang-1403.0.22.14.1)’
- used SDK: ‘MacOSX11.3.1.sdk’
- checking installed package size ... INFO
installed size is 5.8Mb
sub-directories of 1Mb or more:
libs 3.9Mb
- checking package directory ... OK
- checking ‘build’ directory ... OK
- checking DESCRIPTION meta-information ... OK
- checking top-level files ... OK
- checking for left-over files ... OK
- checking index information ... OK
- checking package subdirectories ... OK
- checking code files for non-ASCII characters ... OK
- checking R files for syntax errors ... OK
- checking whether the package can be loaded ... [0s/0s] OK
- checking whether the package can be loaded with stated dependencies ... [0s/0s] OK
- checking whether the package can be unloaded cleanly ... [0s/0s] OK
- checking whether the namespace can be loaded with stated dependencies ... [0s/0s] OK
- checking whether the namespace can be unloaded cleanly ... [0s/0s] OK
- checking loading without being on the library search path ... [0s/0s] OK
- checking dependencies in R code ... OK
- checking S3 generic/method consistency ... OK
- checking replacement functions ... OK
- checking foreign function calls ... OK
- checking R code for possible problems ... [3s/3s] OK
- checking Rd files ... [0s/0s] OK
- checking Rd metadata ... OK
- checking Rd cross-references ... OK
- checking for missing documentation entries ... OK
- checking for code/documentation mismatches ... OK
- checking Rd \usage sections ... OK
- checking Rd contents ... OK
- checking for unstated dependencies in examples ... OK
- checking contents of ‘data’ directory ... OK
- checking data for non-ASCII characters ... [0s/0s] OK
- checking LazyData ... OK
- checking data for ASCII and uncompressed saves ... OK
- checking line endings in C/C++/Fortran sources/headers ... OK
- checking compiled code ... OK
- checking installed files from ‘inst/doc’ ... OK
- checking files in ‘vignettes’ ... OK
- checking examples ... [1s/2s] ERROR
Running examples in ‘heaven-Ex.R’ failed
The error most likely occurred in:
> ### Name: medicinMacro
> ### Title: Medicin macro to estimate prescription lengths and averages
> ### Aliases: medicinMacro
>
> ### ** Examples
>
> set.seed(05021992)
> library(data.table)
> N=20
> packs = list("R03AK11"=list(c(750,75),c(500,200),c(400,200)),
+ "R03AL03"=list(c(750,75),c(500,200),c(400,200)),
+ "C01CA01"=list(c(200,100),c(750,30)))
> lmdb=simPrescriptionData(N,packages=packs)
> lpr=simAdmissionData(N)
> lpr <- getAdmLimits(lpr,collapse=TRUE)
No data errors.
Nothing to collapse.
> drug1 = list(atc=c("R03AK11","R03AL03","R03AC02","R03AC04","R03AC19",
+ "R03AL02","R03AA01","R03AC18","R03AL01"),
+ maxdepot=4000,
+ period=as.Date(c("1995-01-01", "2012-12-31")),
+ prescriptionwindow=2,
+ doses=list(value=c(750,500,400,200,75),
+ min = c(250,200,200,100,25),
+ max = c(1000,600,800,600,100),
+ def = c(750,500,400,200,75)))
> drug2=list(atc=c("C01CA01","C01AA05"),
+ maxdepot=4000,
+ period=as.Date(c("1995-01-01", "2012-12-31")),
+ prescriptionwindow=2,
+ doses=list(value=c(200, 400, 500,750),
+ min = c(100, 200, 250,750),
+ max = c(300, 800, 1000,750),
+ def = c(200, 400, 500,750)))
> x=medicinMacro(drugs=list("drug1"=drug1,"drug2"=drug2),drugdb=lmdb,admdb=lpr)
> x$drug1
Key: <pnr, firstday>
pnr dose firstday lastday exposure.days
<num> <num> <Date> <Date> <difftime>
1: 1 75 1995-01-01 1995-05-18 137 days
2: 1 100 1995-05-18 2008-06-15 4777 days
3: 2 75 1995-01-01 1995-02-16 46 days
4: 2 100 1995-02-16 2002-05-22 2652 days
5: 3 75 1995-01-01 1995-01-22 21 days
6: 3 100 1995-01-22 2003-02-24 2955 days
7: 4 75 1995-01-01 1995-03-03 61 days
8: 4 100 1995-03-03 2001-08-15 2357 days
9: 5 75 1995-01-01 1995-01-10 9 days
10: 5 100 1995-01-10 1996-03-08 423 days
11: 5 0 1996-03-08 1996-03-24 16 days
12: 5 100 1996-03-24 2001-02-12 1786 days
13: 6 75 1995-01-01 1995-01-20 19 days
14: 6 100 1995-01-20 2000-04-14 1911 days
15: 7 75 1995-01-01 1995-03-18 76 days
16: 7 100 1995-03-18 2002-09-13 2736 days
17: 8 75 1995-01-01 1995-02-04 34 days
18: 8 100 1995-02-04 2005-09-06 3867 days
19: 9 75 1995-01-01 1995-01-21 20 days
20: 9 100 1995-01-21 2004-02-05 3302 days
21: 10 75 1995-01-01 1995-06-27 177 days
22: 10 100 1995-06-27 2000-03-11 1719 days
23: 11 75 1995-01-01 1995-01-05 4 days
24: 11 100 1995-01-05 2004-02-12 3325 days
25: 12 75 1995-01-01 1995-03-02 60 days
26: 12 100 1995-03-02 2001-03-09 2199 days
27: 13 75 1995-01-01 1995-02-06 36 days
28: 13 100 1995-02-06 2000-05-28 1938 days
29: 14 75 1995-02-26 1995-03-14 16 days
30: 14 100 1995-03-14 1998-08-15 1250 days
31: 14 0 1998-08-15 1998-10-23 69 days
32: 14 100 1998-10-23 2001-04-24 914 days
33: 15 75 1995-01-01 1995-02-26 56 days
34: 15 100 1995-02-26 2001-12-19 2488 days
35: 16 75 1995-01-01 1995-01-06 5 days
36: 16 100 1995-01-06 2002-01-20 2571 days
37: 17 75 1995-01-01 1995-03-28 86 days
38: 17 100 1995-03-28 1995-12-22 269 days
39: 17 0 1995-12-22 1996-03-04 73 days
40: 17 100 1996-03-04 2006-04-02 3681 days
41: 18 75 1995-01-01 1995-05-05 124 days
42: 18 100 1995-05-05 2004-02-08 3201 days
43: 19 75 1995-01-01 1995-01-09 8 days
44: 19 100 1995-01-09 2008-04-15 4845 days
45: 20 75 1995-01-01 1995-05-20 139 days
46: 20 100 1995-05-20 2000-09-18 1948 days
pnr dose firstday lastday exposure.days
<num> <num> <Date> <Date> <difftime>
>
> ## without admdata
> x1=medicinMacro(drugs=list("drug1"=drug1,"drug2"=drug2),drugdb=lmdb,admdb=NULL)
Error: Mat::elem(): index out of bounds
Execution halted
- checking for unstated dependencies in ‘tests’ ... OK
- checking tests ... [3s/3s] ERROR
Running ‘test-Matcher.R’ [1s/1s]
Running ‘test-cran-compliance.R’ [1s/1s]
Running ‘test-medicin-macro.R’ [1s/1s]
Running the tests in ‘tests/test-medicin-macro.R’ failed.
Complete output:
> ### test-medicin-macro.R ---
> ##----------------------------------------------------------------------
> ## Author: Thomas Alexander Gerds
> ## Created: Mar 11 2019 (12:57)
> ## Version:
> ## Last-Updated: Jan 17 2020 (07:52)
> ## By: Thomas Alexander Gerds
> ## Update #: 12
> ##----------------------------------------------------------------------
> ##
> ### Commentary:
> ##
> ### Change Log:
> ##----------------------------------------------------------------------
> ##
> ### Code:
> library(testthat)
> library(data.table)
> library(heaven)
>
> testmed <- data.table(pnr=1,apk=1L,atc="C03",eksd=as.Date(c("2010-03-18","2010-05-25","2010-08-10","2010-10-05","2010-11-24","2011-01-13","2011-03-07","2011-05-03","2011-06-06","2011-08-02","2011-09-27","2012-02-27","2012-04-23","2012-08-06","2012-11-05","2013-01-15","2013-05-14","2013-08-05","2013-10-28","2014-02-04")),packsize=100,strnum=40)
> testlpr <- simAdmissionData(1)
> testlpr[,pattype:=0]
> drug1=list(atc=c("C03"),
+ maxdepot=4000,
+ period=as.Date(c("2000-01-01", "2016-12-31")),
+ prescriptionwindow=2,
+ doses=list(value=c(40, 400, 500,750),min = c(20, 200, 250,750),max = c(160, 800, 1000,750),def = c(40, 400, 500,750)))
>
> test_that("minimal example",{
+ a <- medicinMacro(drugs=list("drug1"=drug1),
+ drugdb=testmed,
+ admdb=testlpr,
+ admdb.datevars=c("inddto","uddto"))
+ expect_equal(names(a[[1]]),c("pnr","dose","firstday","lastday","exposure.days"))
+ })
── Error: minimal example ──────────────────────────────────────────────────────
<std::out_of_range/C++Error/error/condition>
Error: Mat::elem(): index out of bounds
Backtrace:
▆
1. └─heaven::medicinMacro(...)
2. ├─data.table::rbindlist(...)
3. └─heaven::innerMedicinMacro(...)
Error:
! Test failed with 1 failure and 0 successes.
Backtrace:
▆
1. └─testthat::test_that(...)
2. └─testthat:::test_code(code, parent.frame())
3. ├─withr (local) `<fn>`()
4. └─reporter$end_test(context = reporter$.context, test = test)
5. └─cli::cli_abort(...)
6. └─rlang::abort(...)
Execution halted
- checking for unstated dependencies in vignettes ... OK
- checking package vignettes ... OK
- checking re-building of vignette outputs ... [10s/10s] OK
- checking PDF version of manual ... [4s/4s] OK
- DONE
Status: 2 ERRORs