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

added ... to function call for sf names #2311

Closed

Conversation

andrewbaxter439
Copy link

Closes #2310 by passing the ... of the rename_with functional to the relevant function when applied to names(agr) at

names(agr) = .fn(names(agr))

This now works:

library(stringr)
library(dplyr)
nc <- sf::st_read(system.file("shape/nc.shp", package = "sf"), quiet = TRUE)

nc |> 
    rename_with(str_remove, pattern = "\\d")
#> Simple feature collection with 100 features and 14 fields
#> Geometry type: MULTIPOLYGON
#> Dimension:     XY
#> Bounding box:  xmin: -84.32385 ymin: 33.88199 xmax: -75.45698 ymax: 36.58965
#> Geodetic CRS:  NAD27
#> First 10 features:
#> ...

@andrewbaxter439
Copy link
Author

Brief update - #2312 I think would be a better fix. Happy to close this.

@andrewbaxter439
Copy link
Author

Issue #2310 fixed in pr 0740152

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rename_with.sf doesn't pass arguments as per dplyr::rename_with help file
1 participant