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

relocate() doesn't work when .before and .after are provided a variable inside a function #110

Open
nathaneastwood opened this issue Aug 15, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@nathaneastwood
Copy link
Owner

nathaneastwood commented Aug 15, 2022

r$> myFun <- function(data, col, location = 1) {
      poorman::relocate(data, col, .after = location)
    }

r$> myFun(mtcars, "mpg")
Error in value[[3L]](cond) : Column location does not exist
@nathaneastwood nathaneastwood added the bug Something isn't working label Aug 15, 2022
@nathaneastwood nathaneastwood self-assigned this Aug 15, 2022
@nathaneastwood nathaneastwood changed the title relocate() doesn't work when .before and .after are provided a variable representing a numeric value relocate() doesn't work when .before and .after are provided a variable inside a function Aug 15, 2022
@nathaneastwood
Copy link
Owner Author

.after <- colnames(.data)[eval(bquote(eval_select_pos(.data, .(.after))))]

should fix the issue. Need to test.

@nathaneastwood
Copy link
Owner Author

if (!missing(.after)) .after <- colnames(.data)[eval(bquote(eval_select_pos(.data, .(deparse_var(.after)))))]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant