Skip to content

Commit

Permalink
adapted labels to issue with 'sf_column' not being last
Browse files Browse the repository at this point in the history
  • Loading branch information
jospueyo committed Oct 30, 2024
1 parent 76ccd16 commit 4d135fd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/clean_names.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ clean_names.sf <- function(dat, ..., set_labels = FALSE) {
# clean all but last column
sf_cleaned <- make_clean_names(sf_names[cols_to_rename], ...)
# rename original df
names(dat)[1:n_cols] <- sf_cleaned
names(dat)[cols_to_rename] <- sf_cleaned

if(set_labels){
for (i in seq_along(sf_names[1:n_cols])){
for (i in seq_along(sf_names[cols_to_rename])){
attr(dat[[i]], "label") <- sf_names[[i]]
}
}
Expand Down

0 comments on commit 4d135fd

Please sign in to comment.