-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Error with rename: [renamed variable] must be a symbol or a string, not formula #3232
Comments
I just ran the same and it was fine. From your sessionInfo, it looks like you haven't actually loaded dplyr… library(dplyr, warn.conflicts = F)
rename(iris, sl = Sepal.Length)
#> sl Sepal.Width Petal.Length Petal.Width Species
#> 1 5.1 3.5 1.4 0.2 setosa
#> 2 4.9 3.0 1.4 0.2 setosa
#> 3 4.7 3.2 1.3 0.2 setosa
#> 4 4.6 3.1 1.5 0.2 setosa
#> 5 5.0 3.6 1.4 0.2 setosa
#> 6 5.4 3.9 1.7 0.4 setosa
#> 7 4.6 3.4 1.4 0.3 setosa
#> 8 5.0 3.4 1.5 0.2 setosa
#> 9 4.4 2.9 1.4 0.2 setosa
#> 10 4.9 3.1 1.5 0.1 setosa
sessionInfo()
#> R version 3.4.2 (2017-09-28)
#> Platform: x86_64-apple-darwin15.6.0 (64-bit)
#> Running under: macOS Sierra 10.12.6
#>
#> Matrix products: default
#> BLAS: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRblas.0.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
#>
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] dplyr_0.7.4.9000
#>
#> loaded via a namespace (and not attached):
#> [1] Rcpp_0.12.14 digest_0.6.12 rprojroot_1.2
#> [4] assertthat_0.2.0.9000 R6_2.2.2 backports_1.1.1
#> [7] magrittr_1.5 evaluate_0.10.1 rlang_0.1.4
#> [10] stringi_1.1.6 bindrcpp_0.2 rmarkdown_1.8
#> [13] tools_3.4.2 stringr_1.2.0 glue_1.2.0
#> [16] purrr_0.2.4 yaml_2.1.14 compiler_3.4.2
#> [19] pkgconfig_2.0.1 htmltools_0.3.6 tidyselect_0.2.3
#> [22] bindr_0.1 knitr_1.17.20 tibble_1.3.4 Created on 2017-11-29 by the reprex |
sorry, just updated the session info above (I had copied the code to the clipboard to run the reprex, but hadn't run it). I'm pretty sure this didn't work, but when I install the development version, it seems to just fine: library(dplyr, warn.conflicts = F)
rename(iris, sl = Sepal.Length) %>% str()
#> 'data.frame': 150 obs. of 5 variables:
#> $ sl : num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ...
#> $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ...
#> $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ...
#> $ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ...
#> $ Species : Factor w/ 3 levels "setosa","versicolor",..: 1 1 1 1 1 1 1 1 1 1 ... Here's my session info (below) - the same (I think) except for the
|
@batpigandme could I ask if you could tell me what version of |
@jrosen84 I ran that one with the dev version (should be in the sessionInfo of the reprex-- sorry, I'm on my phone atm). But rename was working fine (as far as I can recall) in the CRAN version, too. I'll double check, though. |
@jrosen48 just re-ran things with the current CRAN version of dplyr (0.7.4) and everything checks out! library(dplyr, warn.conflicts = F)
df <- rename(iris, sl = Sepal.Length)
head(df)
#> sl Sepal.Width Petal.Length Petal.Width Species
#> 1 5.1 3.5 1.4 0.2 setosa
#> 2 4.9 3.0 1.4 0.2 setosa
#> 3 4.7 3.2 1.3 0.2 setosa
#> 4 4.6 3.1 1.5 0.2 setosa
#> 5 5.0 3.6 1.4 0.2 setosa
#> 6 5.4 3.9 1.7 0.4 setosa It was fine, too, when I didn't assign to
|
thanks @batpigandme! |
When I run
rename()
, like I have 100s of times before, I get a strange error:What am I missing here?
Here is my session info.:
The text was updated successfully, but these errors were encountered: