Skip to content

Commit 7a6f5c6

Browse files
committed
Cleaning
1 parent a6eaaed commit 7a6f5c6

File tree

7 files changed

+11
-12
lines changed

7 files changed

+11
-12
lines changed

R/functions_for_processing.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ get_treated_level <- function(treat, estimand, focal = NULL) {
759759

760760
for (i in names(poly_terms)) {
761761
if (poly[i] == 1L) {
762-
poly_terms[[i]] <- d[,i]
762+
poly_terms[[i]] <- d[, i]
763763
poly_co.names[[i]] <- i
764764
}
765765
else {

R/summary.weightit.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,8 @@ plot.summary.weightit <- function(x, binwidth = NULL, bins = NULL, ...) {
238238
fill = "gray70", alpha = 1) +
239239
scale_y_continuous(expand = expansion(c(0, .05))) +
240240
geom_vline(xintercept = mean(w), linetype = "12", color = "blue", size = .75) +
241-
labs(x = "Weight", y = "Count", title = "Distribution of Weights") +
241+
labs(x = "Weight", y = "Count", title = "Distribution of Weights",
242+
subtitle = subtitle) +
242243
theme_bw()
243244
}
244245
else {
@@ -261,7 +262,8 @@ plot.summary.weightit <- function(x, binwidth = NULL, bins = NULL, ...) {
261262
fill = "gray70", alpha = 1) +
262263
scale_y_continuous(expand = expansion(c(0, .05))) +
263264
geom_vline(data = w_means, aes(xintercept = .data$w), linetype = "12", color = "red") +
264-
labs(x = "Weight", y = "Count", title = "Distribution of Weights") +
265+
labs(x = "Weight", y = "Count", title = "Distribution of Weights",
266+
subtitle = subtitle) +
265267
theme_bw() +
266268
facet_wrap(vars(.data$t), ncol = 1L, scales = "free") +
267269
theme(panel.background = element_blank(),

R/utils.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ col.w.r <- function(mat, y, w = NULL, s.weights = NULL, bin.vars = NULL, na.rm =
529529
scale_w <- function(x, w = NULL) {
530530
if (length(dim(x)) == 2L) {
531531
for (i in seq_col(x)) {
532-
x[,i] <- scale_w(x[,i], w)
532+
x[, i] <- scale_w(x[, i], w)
533533
}
534534

535535
return(x)

R/weightit2ebal.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,4 +867,4 @@ weightit2ebal.cont <- function(covs, treat, s.weights, subset, missing, verbose,
867867
#
868868
# list(w = w, fit.obj = fit$opt.out,
869869
# Mparts = Mparts)
870-
# }
870+
# }

R/weightit2optweight.R

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,13 @@
161161
#' cobalt::bal.tab(W2)
162162
#' plot(W2)
163163
#'
164-
#' \dontrun{
165164
#' #Balancing covariates with respect to re75 (continuous)
166165
#' (W3 <- weightit(re75 ~ age + educ + married +
167166
#' nodegree + re74, data = lalonde,
168167
#' method = "optweight", tols = .05))
169168
#' summary(W3)
170169
#' cobalt::bal.tab(W3)
171-
#' plot(W3)}
170+
#' plot(W3)
172171
NULL
173172

174173
weightit2optweight <- function(covs, treat, s.weights, subset, estimand, focal, missing,
@@ -344,7 +343,6 @@ weightit2optweight.cont <- function(covs, treat, s.weights, subset, missing, ver
344343
return(NULL)
345344
}
346345

347-
original.vars <- colnames(covs)
348346
na.cov <- is.na(d$cov)
349347

350348
if (is_not_null(d$treat) && any(na.cov)) {
@@ -360,4 +358,4 @@ weightit2optweight.cont <- function(covs, treat, s.weights, subset, missing, ver
360358
rownames(d) <- NULL
361359

362360
d
363-
}
361+
}

man/method_optweight.Rd

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vignettes/installing-packages.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ If *optweight* is not on CRAN, or if you want to install the development version
163163
pak::pkg_install("ngreifer/optweight")
164164
```
165165

166-
*optweight* depends on the *osqp* package, which requires compilation, which means you may need additional software installed on your computer to install it from source.
166+
*optweight* depends on the *osqp* package, which requires compilation, which means you may need additional software installed on your computer to install it from source. It's also a good idea to install the *highs* and *scs* packages if you want to take advantage of all of *optweight*'s features and optimize its performance.
167167

168168
## Propensity score weighting using SuperLearner (`method = "super"`)
169169

0 commit comments

Comments
 (0)