Skip to content

Commit e90f0ff

Browse files
Fix CodeFactor maintainability & style issues in func_discord_regression.R (#56)
* Initial plan * Fix maintainability and style issues in func_discord_regression.R Co-authored-by: smasongarrison <6001608+smasongarrison@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: smasongarrison <6001608+smasongarrison@users.noreply.github.com>
1 parent d553972 commit e90f0ff

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

R/func_discord_regression.R

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,21 @@ discord_regression <- function(data,
2828
data_processed = FALSE,
2929
coding_method = "none",
3030
fast = TRUE) {
31-
if (data_processed == TRUE & !is.data.frame(data)) {
31+
if (data_processed == TRUE && !is.data.frame(data)) {
3232
stop("data must be a data frame if data_processed is TRUE")
3333
}
3434
if (data_processed == FALSE) {
3535
check_discord_errors(data = data, id = id, sex = sex, race = race, pair_identifiers = pair_identifiers)
3636
}
3737
# if no demographics provided
3838
if (is.null(demographics)) {
39-
if (is.null(sex) & is.null(race)) {
39+
if (is.null(sex) && is.null(race)) {
4040
demographics <- "none"
41-
} else if (is.null(sex) & !is.null(race)) {
41+
} else if (is.null(sex) && !is.null(race)) {
4242
demographics <- "race"
43-
} else if (!is.null(sex) & is.null(race)) {
43+
} else if (!is.null(sex) && is.null(race)) {
4444
demographics <- "sex"
45-
} else if (!is.null(sex) & !is.null(race)) {
45+
} else if (!is.null(sex) && !is.null(race)) {
4646
demographics <- "both"
4747
}
4848
}
@@ -116,7 +116,7 @@ discord_regression <- function(data,
116116
list(formula_obj = formula_)
117117
))
118118

119-
return(model)
119+
model
120120
}
121121

122122
# alias
@@ -164,13 +164,13 @@ discord_between_model <- function(data,
164164

165165
# if no demographics provided
166166
if (is.null(demographics)) {
167-
if (is.null(sex) & is.null(race)) {
167+
if (is.null(sex) && is.null(race)) {
168168
demographics <- "none"
169-
} else if (is.null(sex) & !is.null(race)) {
169+
} else if (is.null(sex) && !is.null(race)) {
170170
demographics <- "race"
171-
} else if (!is.null(sex) & is.null(race)) {
171+
} else if (!is.null(sex) && is.null(race)) {
172172
demographics <- "sex"
173-
} else if (!is.null(sex) & !is.null(race)) {
173+
} else if (!is.null(sex) && !is.null(race)) {
174174
demographics <- "both"
175175
}
176176
}
@@ -243,5 +243,5 @@ discord_between_model <- function(data,
243243
list(formula_obj = formula_)
244244
))
245245

246-
return(model)
246+
model
247247
}

0 commit comments

Comments
 (0)