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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Column Renaming for Selected Columns #9282

Merged
Prev Previous commit
Next Next commit
Merge branch 'master' into updating_seletion_condition
N-thony authored Jan 10, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit bddd9f999707e0a613776849d11394c28471f684
14 changes: 14 additions & 0 deletions instat/static/InstatObject/R/data_object_R6.R
Original file line number Diff line number Diff line change
@@ -1000,6 +1000,11 @@ DataSheet$set("public", "rename_column_in_data", function(curr_col_name = "", ne
}

self$update_selection(column_names, private$.current_column_selection$name)
if(any(c("sfc", "sfc_MULTIPOLYGON") %in% class(private$data[[curr_col_name]]))){
# Update the geometry column reference
sf::st_geometry(private$data) <- new_col_name
}
names(private$data)[names(private$data) == curr_col_name] <- new_col_name

self$append_to_variables_metadata(new_col_name, name_label, new_col_name)
# TODO decide if we need to do these 2 lines
@@ -1031,6 +1036,13 @@ DataSheet$set("public", "rename_column_in_data", function(curr_col_name = "", ne

self$update_selection(column_names, private$.current_column_selection$name)

if(self$column_selection_applied()) self$remove_current_column_selection()
if(any(c("sfc", "sfc_MULTIPOLYGON") %in% class(private$dataprivate$data)[cols_changed_index])){
# Update the geometry column reference
sf::st_geometry(private$data) <- new_col_names
}
names(private$data)[cols_changed_index] <- new_col_names

for (i in seq_along(cols_changed_index)) {
self$append_to_variables_metadata(new_col_names[i], name_label, new_col_names[i])
}
@@ -1055,6 +1067,8 @@ DataSheet$set("public", "rename_column_in_data", function(curr_col_name = "", ne
.fn = .fn,
.cols = {{ .cols }}, ...
)

if(self$column_selection_applied()) self$remove_current_column_selection()
new_col_names <- names(private$data)
if (!all(new_col_names %in% curr_col_names)) {
new_col_names <- new_col_names[!(new_col_names %in% curr_col_names)]
You are viewing a condensed version of this merge commit. You can view the full changes here.