[go: nahoru, domu]

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

Pipeline throws an error when trying to evaluate ":=" using dplyr #50

Open
husamrahman opened this issue Feb 27, 2019 · 2 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@husamrahman
Copy link

The package throws an error if the function it is referencing contains ":=" in one of its operations.

Simply example below where df is any data frame. Running the code below in a normal R console works, however when wrapped in a function and used in the pipeline it throws an error.

Example Cod:
df <- df %>%
mutate(!!sym("this_is_a_test") := 1)

Error:

ERROR [2019-02-27 15:46:58] || EXCEPTION OCCURED WHILE RUNNING THE PIPELINE FUNCTION WITH PROVIDED PARAMETERS: The LHS of := must be a string or a symbol ||
ERROR [2019-02-27 15:46:58] Error in genericPipelineException(error = structure(list(message = "The LHS of := must be a string or a symbol", : || EXCEPTION OCCURED WHILE RUNNING THE PIPELINE FUNCTION WITH PROVIDED PARAMETERS: The LHS of := must be a string or a symbol ||

@naren1991 naren1991 added the bug Something isn't working label Feb 28, 2019
@naren1991 naren1991 self-assigned this Feb 28, 2019
@naren1991
Copy link
Collaborator

There does seem to be an issue using Non-Standard Evaluation, though it seems to relate to the !! operator.

However, what you are trying to accomplish can be done like so:

df <- df %>% mutate(this_is_a_test := 1)

This works within a pipeline.

The problem occurs when a dynamic column name is required which would need you to use the !! operator.

@husamrahman
Copy link
Author

Thanks for the response. The function I was using lets the user define their own variable name, hence the !! operator. I can make a work around but thanks for looking into it!

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

No branches or pull requests

2 participants