Skip to content

Commit 583fd42

Browse files
committed
fixed partial matching for call to print.data.table, and others
1 parent 989f064 commit 583fd42

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

R/data_extension.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ data_extension <- function(data,
5151
N <- N + nrow(switch_data)
5252
for (p in unique(switch_data[["trial_period"]])) {
5353
file_p <- file.path(data_dir, paste0("trial_", p, ".csv"))
54-
fwrite(switch_data[trial_period == p, ], file_p, append = TRUE)
54+
fwrite(switch_data[trial_period == p, ], file = file_p, append = TRUE)
5555
}
5656
}
5757
files <- file.path(data_dir, paste0("trial_", first_period:last_period, ".csv"))
@@ -188,9 +188,9 @@ expand <- function(sw_data,
188188
switch_data[(switch_new == 0 & time_of_event == period_new & outcome_new == 1), case := 1]
189189
}
190190

191-
setnames(switch_data, c("case"), c("outcome"))
192-
setnames(switch_data, c("init"), c("assigned_treatment"))
193-
setnames(switch_data, c("treatment_new"), c("treatment"))
191+
setnames(switch_data, old = c("case"), new = c("outcome"))
192+
setnames(switch_data, old = c("init"), new = c("assigned_treatment"))
193+
setnames(switch_data, old = c("treatment_new"), new = c("treatment"))
194194
switch_data <- switch_data[expand == 1]
195195
switch_data <- switch_data[, keeplist, with = FALSE]
196196

R/generics.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ summary.TE_data_prep_sep <- function(object, ...) {
4747

4848
n_files <- length(object$data)
4949
cat("Expanded data saved in ", n_files, " csv file", if (n_files > 1) "s" else "", ":\n", sep = "")
50-
print(data.table(data = object$data), topn = 3, n = 5, col.names = "none", ...)
50+
print(data.table(data = object$data), topn = 3, nrows = 5, col.names = "none", ...)
5151
cat("\n\n")
5252
NextMethod()
5353
}

R/predict.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ predict.TE_msm <- function(object,
112112
c("followup_time", col_names, "2.5%", "97.5%")
113113
)
114114
} else {
115-
setNames(data.frame(predict_times, pred_matrix[, 1]), c("followup_time", col_names))
115+
setNames(data.frame(predict_times, pred_matrix[, 1]), nm = c("followup_time", col_names))
116116
}
117117
}
118118
)

R/sampling.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ sample_from_period <- function(period_data,
103103
subset_expr,
104104
sort = FALSE) {
105105
if (use_subset) period_data <- subset(period_data, eval(subset_expr))
106-
if (isTRUE(sort)) setorderv(period_data, c("followup_time", "id"))
106+
if (isTRUE(sort)) setorderv(period_data, cols = c("followup_time", "id"))
107107
followup_split <- split(period_data, by = "followup_time")
108108

109109
all_samples <- lapply(p_control, function(p) {

0 commit comments

Comments
 (0)