ohdsi-studies / PioneerWatchfulWaiting

This study is part of the joint PIONEER - EHDEN - OHDSI studyathon in March 2021, and aims to advance understanding of clinical management and outcomes of watchful waiting in prostate cancer.
Apache License 2.0
7 stars 18 forks source link

RunStudy - Error in `colnames<-`(`*tmp*`, value = SqlRender::camelCaseToSnakeCase(colnames(data))) : attempt to set 'colnames' on an object with less than two dimensions #6

Closed scossin closed 3 years ago

scossin commented 3 years ago

The error occurs here: https://github.com/ohdsi-studies/PioneerWatchfulWaiting/blob/2efb021c2e0220df121e9efd6612ac3c56abf600/R/RunStudy.R#L205

 if (nrow(featureProportions) > 0) {
    featureProportions$databaseId <- databaseId
    featureProportions <- enforceMinCellValue(featureProportions, "featureCount", minCellCount)
    featureProportions <- featureProportions[featureProportions$totalCount >= getMinimumSubjectCountForCharacterization(), ]
  }
  features <- formatCovariates(featureProportions)
  writeToCsv(features, file.path(exportFolder, "covariate.csv"), incremental = incremental, covariateId = features$covariateId)

This line:

  featureProportions <- featureProportions[featureProportions$totalCount >= getMinimumSubjectCountForCharacterization(), ]

We have all total counts < 140 (returns by getMinimumSubjectCountForCharacterization()) so featureProportions has 0 row next line and the writeToCsv function generates the error

scossin commented 3 years ago

By changing this number 140 to 20 (https://github.com/scossin/PioneerWatchfulWaiting/commit/7db6afbebb579503052b445039ff28c64acb8181), it finally worked.

keesvanbochove commented 3 years ago

@scossin can you comment if this is still an issue in 0.3.2?

scossin commented 3 years ago

We didn't have this error in version 0.3.2 but I don't know why.