Skip to content

Commit

Permalink
use pull instead of $
Browse files Browse the repository at this point in the history
  • Loading branch information
jianxiaoyang committed Oct 29, 2023
1 parent 5199c52 commit 0e086d5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/NewDataConversion.R
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ convertToCyclopsData.tbl_dbi <- function(outcomes,
}

if (modelType == "pr" | modelType == "cpr") {
if (any(outcomes$time <= 0)) {
if (any((select(outcomes, time) %>% pull()) <= 0)) {

This comment has been minimized.

Copy link
@msuchard

msuchard Oct 30, 2023

Member

could replace with shorter any(pull(outcomes, time) <= 0) do computation in DB via nrow(outcomes %>% filter(time <= 0)) > 0

stop("time cannot be non-positive", call. = FALSE)
}
}
Expand Down Expand Up @@ -419,7 +419,7 @@ convertToCyclopsData.tbl_dbi <- function(outcomes,
stratumId = if ("stratumId" %in% colnames(outcomes)) outcomes$stratumId else NULL,
rowId = outcomes$rowId,
y = outcomes$y,
time = if ("time" %in% colnames(outcomes)) outcomes$time else NULL)
time = if ("time" %in% colnames(outcomes)) (select(outcomes, time) %>% pull()) else NULL)

if (addIntercept & (modelType != "cox" & modelType != "cox_time" & modelType != "fgr")) {
loadNewSqlCyclopsDataX(dataPtr, 0, NULL, NULL, name = "(Intercept)")
Expand Down

0 comments on commit 0e086d5

Please sign in to comment.