We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
rename
The old column of a data frame is somehow "kept" after using the rename function. It happens only when the new name starts with the old name.
df <- data.frame(a = 1:10) df %>% dplyr::rename('a_a' = 'a') -> df df$a_a # [1] 1 2 3 4 5 6 7 8 9 10 'a' %in% names(df) # [1] FALSE df$a # [1] 1 2 3 4 5 6 7 8 9 10
The text was updated successfully, but these errors were encountered:
This is not a bug, when you are using df$a, R uses partial matching to grab a_a.
tmp <- data.frame(a_a = 1:10) tmp$a #> [1] 1 2 3 4 5 6 7 8 9 10
Created on 2024-10-22 with reprex v2.1.1
Sorry, something went wrong.
@sda030 is right
No branches or pull requests
The old column of a data frame is somehow "kept" after using the
rename
function. It happens only when the new name starts with the old name.The text was updated successfully, but these errors were encountered: