'Error when R package building: `:=` can only be used within dynamic dots
So I've written this function here which renames the first column in a data frame:
{
df %>%
rename({{newname}} := colnames(df[1]))
}
It ran completely fine. Now when I moved this function to a package I' m building, it suddenly started giving me this error: Error: := can only be used within dynamic dots.
I have imported rlang into my package so that's not the problem (before I did that it gave me a different error about not recognizing := at all).
I have no idea what has changed by moving the function to a different folder and google is not much help either.
Solution 1:[1]
I solved this myself :) I had to put dplyr:: in front of rename because it was confusing it with plyr::rename which is apparently very different.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
