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

select_ Fails with Open Parenthesis in Column Name #4043

Closed
billdenney opened this issue Dec 20, 2018 · 4 comments
Closed

select_ Fails with Open Parenthesis in Column Name #4043

billdenney opened this issue Dec 20, 2018 · 4 comments

Comments

@billdenney
Copy link
Contributor

select_() fails when there is an open parenthesis without a close parenthesis in the column name:

library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
foo <- tibble(A=1, B=2, C=3)
names(foo)[1:3] <- "A(B"
foo %>%
  dplyr::select_(.dots=names(foo))
#> Error in parse(text = x): <text>:2:0: unexpected end of input
#> 1: A(B
#>    ^

Created on 2018-12-19 by the reprex package (v0.2.0).

@billdenney
Copy link
Contributor Author

This is the underlying issue for UUPharmacometrics/xpose#125

@romainfrancois
Copy link
Member

romainfrancois commented Dec 20, 2018

select_() is deprecated, can xpose use select_at(names(foo)) instead ?

@romainfrancois
Copy link
Member

It's a problem with the previous lazy evaluation system :

library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
foo <- tibble(A=1, B=2, C=3)
names(foo)[3] <- "A(B"
foo 
#> # A tibble: 1 x 3
#>       A     B `A(B`
#>   <dbl> <dbl> <dbl>
#> 1     1     2     3

foo %>% select_at(names(foo))
#> # A tibble: 1 x 3
#>       A     B `A(B`
#>   <dbl> <dbl> <dbl>
#> 1     1     2     3
foo %>% select_(.dots=names(foo))
#> Error in parse(text = x): <text>:2:0: unexpected end of input
#> 1: A(B
#>    ^

names(foo)[1:3] <- "A(B"
foo %>% select_at(names(foo))
#> Error: Can't bind data because some arguments have the same name
foo %>% select_(.dots=names(foo))
#> Error in parse(text = x): <text>:2:0: unexpected end of input
#> 1: A(B
#>    ^

dplyr:::compat_lazy("A(B", environment())
#> Error in parse(text = x): <text>:2:0: unexpected end of input
#> 1: A(B
#>    ^

This probably won't be fixed, xpose should use select_at() instead.

@lock
Copy link

lock bot commented Jun 18, 2019

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Jun 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants