Running ‘testthat.R’ [28s/38s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(PatientLevelPrediction)
  > test_check("PatientLevelPrediction")
  Internet: TRUE
  PredictionDistribution not available for survival models
  No databaseRefId specified so using schema as unique database identifier
  Starting to limit covariate data to population...
  Calculating covariate summary @ 2025-05-26 13:51:12.342977
  This can take a while...
  calculating subset of strata 1
  Restricting to subgroup
  Calculating summary for subgroup 
  Aggregating with no labels or strata
  Finished covariate summary @ 2025-05-26 13:51:14.077795
  Time to calculate covariate summary: 1.74 secs
  Calculating covariate summary @ 2025-05-26 13:51:14.088138
  This can take a while...
  calculating subset of strata 1
  Restricting to subgroup
  Calculating summary for subgroup 
  Aggregating with no labels or strata
  Finished covariate summary @ 2025-05-26 13:51:16.08667
  Time to calculate covariate summary: 2 secs
  Calculating covariate summary @ 2025-05-26 13:51:16.099324
  This can take a while...
  Creating binary labels
  calculating subset of strata 1
  calculating subset of strata 2
  Restricting to subgroup
  Calculating summary for subgroup WithOutcome
  Restricting to subgroup
  Calculating summary for subgroup WithNoOutcome
  Aggregating with only labels or strata
  Finished covariate summary @ 2025-05-26 13:51:19.57103
  Time to calculate covariate summary: 3.47 secs
  Restricting to subgroup
  variance needs to be >= 0
  variance should be of class:numericvariance should be of class:integer
  seed should be of class:numericseed should be of class:NULLseed should be of class:integer
  threads should be of class:numericthreads should be of class:integer
  lowerLimit should be of class:numericlowerLimit should be of class:integer
  upperLimit should be of class:numericupperLimit should be of class:integer
  upperLimit needs to be >= 3
  Calulating evaluation summary Started @ 2025-05-26 13:51:21.46312
  Evaluating survival model at time: 365 days
  Calculating C-statistic
  C-statistic: 0.37475 (0.201-0.549)
  E-statistic: 0.0263990422395753
  E-statistic 90%: 0.050967405996051
  Calulating threshold summary Started @ 2025-05-26 13:51:21.495303
  Calulating Demographic Based Evaluation Started @ 2025-05-26 13:51:22.232448
  Calculating Calibration Summary Started @ 2025-05-26 13:51:22.338097
  Calculating Quantiles Started @ 2025-05-26 13:51:22.360864
  PredictionDistribution not available for survival models
  Time to calculate evaluation metrics: 0.898 secs
  Setting levels: control = 0, case = 1
  Column names of coefficients are not correct
  Column types of coefficients are not correct
  Column types of coefficients are not correct
  intercept should be of class:numeric
  mapping should be of class:charactermapping should be of class:function
  targetId should be of class:numerictargetId should be of class:NULL
  outcomeId should be of class:numericoutcomeId should be of class:NULL
  populationSettings should be of class:NULLpopulationSettings should be of class:populationSettings
  restrictPlpDataSettings should be of class:NULLrestrictPlpDataSettings should be of class:restrictPlpDataSettings
  covariateSettings should be of class:listcovariateSettings should be of class:NULLcovariateSettings should be of class:covariateSettings
  requireDenseMatrix should be of class:logical
  databaseDetails should be of class:databaseDetails
  databaseDetails should be of class:databaseDetails
  databaseDetails should be of class:databaseDetails
  No cdm database name entered so using cdmDatabaseSchema
  threshold needs to be >= 0
  threshold should be of class:numeric
  threshold needs to be < 1
  starting to map the columns and rows
  finished MapCovariates
  starting to map the columns and rows
  finished MapCovariates
  plpData size estimated to use 0GBs of RAM
  starting toSparseM
  Max covariateId in original covariates: 1233105
  starting to map the columns and rows
  finished MapCovariates
  # covariates in mapped covariateRef: NA
  Max newCovariateId in mapping: 9
  Max rowId in new : 5
  toSparseM non temporal used
  plpData size estimated to use 0GBs of RAM
  Sparse matrix with dimensionality: 5,9
  finishing toSparseM
  toSparseM took 2.77098703384399 secs
  starting to map the columns and rows
  Imputation is experimental and may have bugs,
      please report any issues on the GitHub repository.
  Imputation is experimental and may have bugs,
      please report any issues on the GitHub repository.
  Imputation is experimental and may have bugs,
      please report any issues on the GitHub repository.
  missingThreshold needs to be > 0
  Imputation is experimental and may have bugs,
      please report any issues on the GitHub repository.
  missingThreshold should be of class:numeric
  Imputation is experimental and may have bugs,
      please report any issues on the GitHub repository.
  missingThreshold needs to be < 1
  Imputation is experimental and may have bugs,
      please report any issues on the GitHub repository.
  method should be mean or median
  Imputation is experimental and may have bugs. 
      Please report any issues on the GitHub repository.
  Imputation is experimental and may have bugs. 
      Please report any issues on the GitHub repository.
  method should be pmm
  Imputation is experimental and may have bugs. 
      Please report any issues on the GitHub repository.
  missingThreshold needs to be > 0
  Imputation is experimental and may have bugs. 
      Please report any issues on the GitHub repository.
  missingThreshold should be of class:numeric
  Imputation is experimental and may have bugs. 
      Please report any issues on the GitHub repository.
  missingThreshold needs to be < 1
  Imputation is experimental and may have bugs. 
      Please report any issues on the GitHub repository.
  type should be minmax or robust
  type should be minmax or robust
  type should be minmax or robust
  type should be minmax or robust
  settings$clip needs to be a boolean
  1 needs to be a boolean
  "tertet" needs to be a boolean
  1 needs to be >= 2
  "tertet" needs to be >= 1
  2 needs to be <= 1
  "tertet" needs to be <= 1
  1 needs to be > 2
  0 needs to be > 0
  "tertet" needs to be > 1
  2 needs to be < 1
  0 needs to be < 0
  "tertet" needs to be < 1
  NULL cannot be empty
  "dsdsds" should be of class:double
  "dsdsds" should be dsds or double
  Creating save directory at: /tmp/RtmpTVtzcR/file2dadf11293a228
  file does not exist
  Column names of data.frame(a = 1:2, b = 1:2) are not correct
  Column types of data.frame(a = 1:2, b = 1:2) are not correct
  includeAllOutcomes should be of class:logical
  includeAllOutcomes should be of class:logical
  firstExposureOnly should be of class:logical
  firstExposureOnly should be of class:logical
  washoutPeriod should be of class:numericwashoutPeriod should be of class:integer
  washoutPeriod needs to be >= 0
  removeSubjectsWithPriorOutcome should be of class:logical
  removeSubjectsWithPriorOutcome should be of class:logical
  priorOutcomeLookback should be of class:numericpriorOutcomeLookback should be of class:integer
  priorOutcomeLookback needs to be >= 0
  requireTimeAtRisk should be of class:logical
  requireTimeAtRisk should be of class:logical
  minTimeAtRisk should be of class:numericminTimeAtRisk should be of class:integer
  minTimeAtRisk needs to be >= 0
  riskWindowStart should be of class:numericriskWindowStart should be of class:integer
  riskWindowEnd should be of class:numericriskWindowEnd should be of class:integer
  startAnchor should be of class:character
  endAnchor should be of class:character
  minFraction needs to be >= 0
  minFraction should be of class:numericminFraction should be of class:integer
  removeRedundancy should be of class:logical
  removeRedundancy should be of class:logical
  normalize should be of class:logical
  normalize should be of class:logical
  runSplitData should be of class:logical
  runSampleData should be of class:logical
  runFeatureEngineering should be of class:logical
  runPreprocessData should be of class:logical
  runModelDevelopment should be of class:logical
  runCovariateSummary should be of class:logical
  numberOutcomestoNonOutcomes should be of class:numericnumberOutcomestoNonOutcomes should be of class:integer
  numberOutcomestoNonOutcomes needs to be > 0
  sampleSeed should be of class:numericsampleSeed should be of class:integer
  type should be of class:character
  plpData object
  
  At risk concept ID: 
  Outcome concept ID(s): 
  plpData object summary
  
  At risk cohort concept ID: 
  Outcome concept ID(s): 
  
  People: 
  
  Outcome counts:
  Creating directory to save model
  Computing covariate prevalence
  Fitting outcome model(s)
  Generating covariates
  restrictPlpDataSettings are not the same in models and validationDesign,
                                using from design
  restrictPlpDataSettings not set in design, using model's
  targetId should be of class:numerictargetId should be of class:integer
  outcomeId should be of class:numericoutcomeId should be of class:integer
  targetId should be of class:numerictargetId should be of class:integer
  outcomeId should be of class:numericoutcomeId should be of class:integer
  populationSettings should be of class:populationSettings
  recalibrate should be of class:characterrecalibrate should be of class:NULL
  runCovariateSummary should be of class:logical
  [ FAIL 12 | WARN 5 | SKIP 114 | PASS 518 ]
  
  ══ Skipped tests (114) ═════════════════════════════════════════════════════════
  • On CRAN (84): 'test-LightGBM.R:18:3', 'test-LightGBM.R:68:3',
    'test-LightGBM.R:89:3', 'test-UploadToDatabase.R:202:3',
    'test-UploadToDatabase.R:252:3', 'test-UploadToDatabase.R:307:3',
    'test-UploadToDatabase.R:415:3', 'test-andromedahelperfunctions.R:19:3',
    'test-cyclopsModels.R:93:3', 'test-cyclopsModels.R:149:3',
    'test-cyclopsModels.R:166:3', 'test-cyclopsModels.R:216:3',
    'test-cyclopsModels.R:228:3', 'test-diagnostic.R:60:3',
    'test-diagnostic.R:111:3', 'test-evaluation.R:17:3',
    'test-evaluation.R:27:3', 'test-existingModel.R:18:3',
    'test-existingModel.R:75:3', 'test-existingModel.R:123:3',
    'test-extractData.R:17:3', 'test-extractData.R:43:3',
    'test-extractData.R:62:3', 'test-extractData.R:93:3',
    'test-extractData.R:112:3', 'test-extractData.R:156:3',
    'test-extractData.R:185:3', 'test-extractData.R:204:3',
    'test-extractData.R:231:3', 'test-featureEngineering.R:40:3',
    'test-featureEngineering.R:56:3', 'test-featureEngineering.R:84:3',
    'test-featureEngineering.R:130:3', 'test-featureEngineering.R:158:3',
    'test-featureEngineering.R:203:3', 'test-featureEngineering.R:248:3',
    'test-featureEngineering.R:316:3', 'test-featureEngineering.R:343:3',
    'test-featureImportance.R:19:3', 'test-featureImportance.R:45:3',
    'test-fitting.R:20:3', 'test-fitting.R:33:3', 'test-formatting.R:103:3',
    'test-helperfunctions.R:33:3', 'test-imputation.R:93:3',
    'test-imputation.R:183:3', 'test-plotting.R:21:3', 'test-plotting.R:60:3',
    'test-plotting.R:74:3', 'test-plotting.R:91:3', 'test-plotting.R:126:3',
    'test-plotting.R:148:3', 'test-plotting.R:155:3', 'test-plotting.R:165:3',
    'test-plotting.R:174:3', 'test-plotting.R:182:3', 'test-plotting.R:193:3',
    'test-plotting.R:202:3', 'test-rclassifier.R:18:3',
    'test-rclassifier.R:62:3', 'test-rclassifier.R:82:3',
    'test-rclassifier.R:116:3', 'test-sklearnClassifier.R:19:3',
    'test-sklearnClassifier.R:51:3', 'test-sklearnClassifier.R:62:3',
    'test-sklearnClassifier.R:95:3', 'test-sklearnClassifier.R:111:3',
    'test-sklearnClassifier.R:131:3', 'test-sklearnClassifier.R:156:3',
    'test-sklearnClassifier.R:180:3', 'test-sklearnClassifier.R:197:3',
    'test-sklearnClassifier.R:218:3', 'test-sklearnClassifierSettings.R:19:3',
    'test-sklearnClassifierSettings.R:51:3',
    'test-sklearnClassifierSettings.R:61:3',
    'test-sklearnClassifierSettings.R:116:3',
    'test-sklearnClassifierSettings.R:135:3',
    'test-sklearnClassifierSettings.R:181:3', 'test-sklearnJson.R:39:3',
    'test-sklearnJson.R:57:3', 'test-sklearnJson.R:75:3',
    'test-sklearnJson.R:93:3', 'test-sklearnJson.R:111:3',
    'test-sklearnJson.R:130:3'
  • only run on CI (4): 'test-UploadToDatabase.R:39:3',
    'test-UploadToDatabase.R:92:3', 'test-UploadToDatabase.R:113:3',
    'test-UploadToDatabase.R:163:3'
  • {Eunomia} is not installed (26): 'test-population.R:262:3',
    'test-population.R:470:3', 'test-prediction.R:17:3',
    'test-prediction.R:38:3', 'test-prediction.R:77:3',
    'test-preprocessingData.R:55:3', 'test-preprocessingData.R:117:3',
    'test-runPlpHelpers.R:17:3', 'test-runPlpHelpers.R:31:3',
    'test-sampling.R:90:3', 'test-sampling.R:131:3', 'test-sampling.R:162:3',
    'test-saveloadplp.R:30:3', 'test-saveloadplp.R:45:3',
    'test-saveloadplp.R:86:3', 'test-saveloadplp.R:170:3',
    'test-validation.R:43:3', 'test-validation.R:67:3',
    'test-validation.R:200:3', 'test-validation.R:225:3',
    'test-validation.R:240:3', 'test-validation.R:261:3',
    'test-validation.R:286:3', 'test-validation.R:314:3',
    'test-validation.R:344:3', 'test-validation.R:367:3'
  
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Error ('test-andromedahelperfunctions.R:61:3'): limitPop with timeRef ───────
  Error in `covariateData$covariateRef`: $ operator not defined for this S4 class
  Backtrace:
      ▆
   1. └─PatientLevelPrediction:::limitCovariatesToPopulation(covs, rowIds) at test-andromedahelperfunctions.R:61:3
   2.   └─Andromeda::andromeda(...)
  ── Error ('test-covariateSummary.R:112:3'): covariateSummarySubset works with temporal data ──
  Error in `isValidAndromeda(x)`: x is not an Andromeda object.
  Backtrace:
      ▆
   1. └─PatientLevelPrediction:::covariateSummarySubset(covs, rowIds) at test-covariateSummary.R:112:3
   2.   └─PatientLevelPrediction:::getCovariatesForGroup(...)
   3.     └─Andromeda::copyAndromeda(covariateData)
   4.       └─Andromeda:::checkIfValid(andromeda)
   5.         └─Andromeda::isValidAndromeda(x)
   6.           └─rlang::abort(paste(deparse(substitute(x)), "is not an Andromeda object."))
  ── Error ('test-dataSplitting.R:19:3'): (code run outside of `test_that()`) ────
  Error in `eval(code, test_env)`: object 'plpData' not found
  ── Error ('test-existingModel.R:285:3'): Existing glm model works ──────────────
  Error in `eval(code, test_env)`: object 'testData' not found
  Backtrace:
      ▆
   1. └─PatientLevelPrediction::predictPlp(model, testData, testData$labels) at test-existingModel.R:285:3
  ── Error ('test-extractData.R:137:3'): Print and print summary plpData work ────
  Error in `eval(code, test_env)`: object 'plpData' not found
  Backtrace:
      ▆
   1. ├─utils::capture.output(print(plpData)) at test-extractData.R:137:3
   2. │ └─base::withVisible(...elt(i))
   3. └─base::print(plpData)
  ── Error ('test-formatting.R:256:3'): MapIds with temporalData ─────────────────
  Error in `covariateData$covariates`: $ operator not defined for this S4 class
  Backtrace:
      ▆
   1. ├─PatientLevelPrediction::MapIds(formattingCovs) at test-formatting.R:256:3
   2. │ ├─base::data.frame(...)
   3. │ └─... %>% dplyr::pull()
   4. ├─dplyr::pull(.)
   5. └─dplyr::distinct(., .data$rowId)
  ── Error ('test-learningCurves.R:19:1'): (code run outside of `test_that()`) ───
  Error in `eval(code, test_env)`: object 'outcomeId' not found
  Backtrace:
      ▆
   1. └─PatientLevelPrediction::createLearningCurve(...) at test-learningCurves.R:19:1
  ── Error ('test-multiplePlp.R:16:1'): (code run outside of `test_that()`) ──────
  Error in `eval(code, test_env)`: object 'outcomeId' not found
  Backtrace:
      ▆
   1. └─PatientLevelPrediction::createModelDesign(...) at test-multiplePlp.R:16:1
   2.   └─PatientLevelPrediction:::checkIsClass(...)
  ── Error ('test-normalizers.R:40:5'): normalization works ──────────────────────
  Error in `eval(code, test_env)`: object 'tinyTrainData' not found
  Backtrace:
      ▆
   1. └─PatientLevelPrediction (local) testNormalizer(tinyTrainData, testData, normalizer) at test-normalizers.R:162:3
   2.   └─PatientLevelPrediction (local) addFeature(data, 12101, -10, 10, outliers = outliers) at test-normalizers.R:93:5
   3.     └─Andromeda::copyAndromeda(data$covariateData) at test-normalizers.R:40:5
   4.       └─Andromeda:::checkIfValid(andromeda)
   5.         └─Andromeda::isValidAndromeda(x)
   6.           └─Andromeda::isAndromeda(x)
  ── Error ('test-preprocessingData.R:152:3'): apply tidy with temporal data ─────
  Error in `covariateData$covariateRef`: $ operator not defined for this S4 class
  Backtrace:
      ▆
   1. └─PatientLevelPrediction:::applyTidyCovariateData(covs, preprocessSettings) at test-preprocessingData.R:152:3
   2.   └─Andromeda::andromeda(...)
  ── Error ('test-recalibration.R:26:1'): (code run outside of `test_that()`) ────
  Error in `eval(code, test_env)`: object 'outcomeId' not found
  ── Error ('test-simulation.R:108:3'): simulatePlpData works ────────────────────
  Error in `covariateData$covariates`: $ operator not defined for this S4 class
  Backtrace:
      ▆
   1. ├─PatientLevelPrediction::simulatePlpData(dummyProfile, n = n) at test-simulation.R:108:3
   2. │ └─covariateData$covariates %>% ...
   3. └─dplyr::filter(., !.data$covariateId %in% !!continuousCovariates$covariateId)
  
  [ FAIL 12 | WARN 5 | SKIP 114 | PASS 518 ]
  Error: Test failures
  Execution halted