Skip to content

Commit

Permalink
Tibble dependancy removal (#422)
Browse files Browse the repository at this point in the history
* remove tibble dependancy
  • Loading branch information
egillax authored Dec 20, 2023
1 parent 6ff8397 commit b6fb110
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ Imports:
rlang,
SqlRender (>= 1.1.3),
survival,
tibble,
tidyr,
utils
Suggests:
Expand Down Expand Up @@ -77,6 +76,6 @@ Remotes:
ohdsi/IterativeHardThresholding,
ohdsi/ParallelLogger,
ohdsi/ShinyAppBuilder,
ohdsi/ResultModelManager
ohdsi/ResultModelManager,
RoxygenNote: 7.2.3
Encoding: UTF-8
2 changes: 1 addition & 1 deletion R/AndromedaHelperFunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ calculatePrevs <- function(plpData, population){
#===========================

# add population to sqllite
population <- tibble::as_tibble(population)
population <- dplyr::as_tibble(population)
plpData$covariateData$population <- population %>%
dplyr::select("rowId", "outcomeCount")

Expand Down
6 changes: 3 additions & 3 deletions R/FeatureImportance.R
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ permute <- function(plpDataLocation,cId,population){

# find a new random selection of people and give them the covariate and value
newPlp <- sample(population$rowId,nSamp)
newData <- tibble::as_tibble(cbind(rowId = newPlp,coi[,-1]))
newData <- dplyr::as_tibble(cbind(rowId = newPlp,coi[,-1]))

# swap old covariate data with new
plpData$covariateData$covariates <- plpData$covariateData$covariates %>% dplyr::filter(.data$covariateId != !!cId) %>% dplyr::collect()
Expand All @@ -215,7 +215,7 @@ permute <- function(plpDataLocation,cId,population){

# sample the pop to replace
swapPlp <- sample(population$rowId,nSamp)
haveCidDataSwapped <- tibble::as_tibble(cbind(rowId = swapPlp,haveCidData[,-1]))
haveCidDataSwapped <- dplyr::as_tibble(cbind(rowId = swapPlp,haveCidData[,-1]))

# find the swapped people to switch
connectedCovs <- plpData$covariateData$covariateRef %>%
Expand All @@ -228,7 +228,7 @@ permute <- function(plpDataLocation,cId,population){
dplyr::filter(.data$rowId %in% swapPlp) %>%
dplyr::collect()

swappedForCid <- tibble::as_tibble(cbind(rowId = haveCidData$rowId[1:nrow(plpToSwap)],plpToSwap[,-1]))
swappedForCid <- dplyr::as_tibble(cbind(rowId = haveCidData$rowId[1:nrow(plpToSwap)],plpToSwap[,-1]))


# swap old covariate data with new
Expand Down
2 changes: 1 addition & 1 deletion R/Predict.R
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ applyTidyCovariateData <- function(

if(!is.null(maxs)){
if('bins'%in%colnames(maxs)){
covariateData$maxes <- tibble::as_tibble(maxs) %>% dplyr::rename(covariateId = "bins") %>%
covariateData$maxes <- dplyr::as_tibble(maxs) %>% dplyr::rename(covariateId = "bins") %>%
dplyr::rename(maxValue = "maxs")
} else{
covariateData$maxes <- maxs
Expand Down

0 comments on commit b6fb110

Please sign in to comment.