Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[R-package] remove unused internal variables #5991

Merged
merged 2 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 3 additions & 4 deletions R-package/R/lgb.Dataset.R
Original file line number Diff line number Diff line change
Expand Up @@ -494,11 +494,10 @@ Dataset <- R6::R6Class(
if (info_len > 0L) {

# Get back fields
ret <- NULL
ret <- if (field_name == "group") {
integer(info_len)
if (field_name == "group") {
ret <- integer(info_len)
} else {
numeric(info_len)
ret <- numeric(info_len)
}

.Call(
Expand Down
2 changes: 0 additions & 2 deletions R-package/R/lgb.Predictor.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ Predictor <- R6::R6Class(
start_iteration <- 0L
}

num_row <- 0L

# Check if data is a file name and not a matrix
if (identical(class(data), "character") && length(data) == 1L) {

Expand Down
4 changes: 0 additions & 4 deletions R-package/R/lgb.convert_with_rules.R
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,6 @@ lgb.convert_with_rules <- function(data, rules = NULL) {

column_classes <- .get_column_classes(df = data)

is_char <- which(column_classes == "character")
is_factor <- which(column_classes == "factor")
is_logical <- which(column_classes == "logical")

is_data_table <- data.table::is.data.table(x = data)
is_data_frame <- is.data.frame(data)

Expand Down
2 changes: 0 additions & 2 deletions R-package/R/lgb.cv.R
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,6 @@ lgb.cv <- function(params = list()
stop(sQuote("folds"), " must be a list with 2 or more elements that are vectors of indices for each CV-fold")
}

nfold <- length(folds)

} else {

if (nfold <= 1L) {
Expand Down
2 changes: 1 addition & 1 deletion R-package/tests/testthat/test_lgb.Booster.R
Original file line number Diff line number Diff line change
Expand Up @@ -1341,7 +1341,7 @@ test_that("Booster's print, show, and summary work correctly", {
.has_expected_content_for_fitted_model(log_txt)

# summary()
log_text <- capture.output({
log_txt <- capture.output({
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one was actually a bug! The assertions below this check a variable named log_txt, which is the output of the previous command. With this change, that assertion actually checks the result of this call.

ret <- summary(model)
})
.have_same_handle(ret, model)
Expand Down