# \donttest{
library(data.table)
# 1. Create dummy data with ALL columns required by the lm() formulas
DT <- data.table(
I = rpois(30, lambda = 5),
C = rpois(30, lambda = 3),
trans_FC = sample(0:1, 30, replace = TRUE), # Treatment
t_norm = rnorm(30), # Trend/Time
PopDensity = rnorm(30), # Benchmark Covariate
War = sample(0:1, 30, replace = TRUE) # Benchmark Covariate
)
# 2. Define global path using tempdir() (Fixes CRAN policy)
# run_sensemakr writes output to 'dir_csv', so it must be defined.
tmp_dir <- tempdir()
dir_csv <- file.path(tmp_dir, "csv")
if (!dir.exists(dir_csv)) dir.create(dir_csv, recursive = TRUE)
# 3. Run the function
# This requires the 'sensemakr' package to be installed.
res_sense <- run_sensemakr(DT)
# Inspect results
if (!is.null(res_sense$I)) {
print(summary(res_sense$I))
}
# }
Run the code above in your browser using DataLab