From 886523c36d1b65369c8dc721d8be9558fde3152c Mon Sep 17 00:00:00 2001 From: "Zhao, Yujie" Date: Mon, 18 Mar 2024 11:28:34 -0400 Subject: [PATCH 1/3] filter out 0 event rows in `pw_info` --- R/pw_info.R | 2 ++ 1 file changed, 2 insertions(+) diff --git a/R/pw_info.R b/R/pw_info.R index 72b7df1e..6234744c 100644 --- a/R/pw_info.R +++ b/R/pw_info.R @@ -204,6 +204,8 @@ pw_info <- function( ans <- ans[, .(time, stratum, t, hr, event, info, info0)] setorderv(ans, cols = c("time", "stratum")) ans <- ans[order(t), .SD, by = .(time, stratum)] + # filter out the rows with 0 events + ans[!is_almost_k(event, 0),] setDF(ans) return(ans) } From a82d95046ddfc5cdbb3049a3a40ea30c0f6feb4a Mon Sep 17 00:00:00 2001 From: "Zhao, Yujie" Date: Mon, 18 Mar 2024 11:33:46 -0400 Subject: [PATCH 2/3] 1 lintr issue --- R/pw_info.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/pw_info.R b/R/pw_info.R index 6234744c..59d0ee63 100644 --- a/R/pw_info.R +++ b/R/pw_info.R @@ -205,7 +205,7 @@ pw_info <- function( setorderv(ans, cols = c("time", "stratum")) ans <- ans[order(t), .SD, by = .(time, stratum)] # filter out the rows with 0 events - ans[!is_almost_k(event, 0),] + ans[!is_almost_k(event, 0), ] setDF(ans) return(ans) } From f22083e3b7016d8be7678bfba05b64e6a6e6804b Mon Sep 17 00:00:00 2001 From: Nan Xiao Date: Mon, 18 Mar 2024 13:39:34 -0400 Subject: [PATCH 3/3] Use canonical data.table syntax for subsetting --- R/pw_info.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/pw_info.R b/R/pw_info.R index 59d0ee63..99f267f5 100644 --- a/R/pw_info.R +++ b/R/pw_info.R @@ -205,7 +205,7 @@ pw_info <- function( setorderv(ans, cols = c("time", "stratum")) ans <- ans[order(t), .SD, by = .(time, stratum)] # filter out the rows with 0 events - ans[!is_almost_k(event, 0), ] + ans <- ans[!is_almost_k(event, 0L)] setDF(ans) return(ans) }