OHDSI / PhenotypeLibrary

A repository to store, organize and maintain the content of the OHDSI Phenotype library. OHDSI Forum post https://forums.ohdsi.org/t/ohdsi-phenotype-library-announcements/16910
https://ohdsi.github.io/PhenotypeLibrary/
Other
41 stars 16 forks source link

R check notes need solving #46

Closed schuemie closed 1 year ago

schuemie commented 1 year ago

R check reveals some issues in the code that need to be fixed:

* checking R code for possible problems ... NOTE
getPhenotypeLog: no visible binding for global variable ‘cohortId’
getPhenotypeLog: no visible binding for global variable ‘addedVersion’
getPhenotypeLog: no visible binding for global variable ‘addedDate’
getPhenotypeLog: no visible binding for global variable
  ‘deprecatedVersion’
getPhenotypeLog: no visible binding for global variable
  ‘deprecatedDate’
getPhenotypeLog: no visible binding for global variable
  ‘updatedVersion’
getPhenotypeLog: no visible binding for global variable ‘updatedDate’
getPhenotypeLog: no visible binding for global variable ‘notes’
getPlCohortDefinitionSet: no visible binding for global variable
  ‘cohortId’
updatePhenotypeLog: no visible binding for global variable
  ‘createdDate’
updatePhenotypeLog: no visible binding for global variable
  ‘modifiedDate’
updatePhenotypeLog: no visible binding for global variable ‘name’
updatePhenotypeLog: no visible binding for global variable
  ‘description’
updatePhenotypeLog: no visible binding for global variable ‘cohortId’
updatePhenotypeLog: no visible binding for global variable ‘cohortName’
updatePhenotypeLog: no visible binding for global variable ‘addedDate’
updatePhenotypeLog: no visible binding for global variable
  ‘updatedDate’
updatePhenotypeLog: no visible binding for global variable ‘notes’
updatePhenotypeLog: no visible binding for global variable ‘getResults’
updatePhenotypeLog: no visible binding for global variable
  ‘addedVersion’
updatePhenotypeLog: no visible binding for global variable
  ‘deprecatedDate’
updatePhenotypeLog: no visible binding for global variable
  ‘deprecatedVersion’
updatePhenotypeLog: no visible binding for global variable
  ‘updatedVersion’
Undefined global functions or variables:
  addedDate addedVersion cohortId cohortName createdDate deprecatedDate
  deprecatedVersion description getResults modifiedDate name notes
  updatedDate updatedVersion

I think these are all caused by not using .data$ or quotes in dplyr calls. For example, this

cohorts <- listPhenotypes() %>%
    filter(cohortId %in% cohortIds)

should be

cohorts <- listPhenotypes() %>%
    filter(.data$cohortId %in% cohortIds)

Of course, nowadays select and rename need quotes instead of .data$.

gowthamrao commented 1 year ago

@schuemie looks like this is no more an issue. getPhenotypeLog was updated.