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

glue object drops "glue" class when subsetted #66

Closed
austensen opened this Issue Nov 5, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@austensen

austensen commented Nov 5, 2017

I noticed that using glue in dplyr::if_else or dplyr::case_when raised errors that the objects aren't of the same class. In tidyverse/dplyr#3109 Hadley said "this looks like a glue issue - it shouldn't dropping the class when subsetted."

# devtools::install_github("tidyverse/glue")

library(glue)

dplyr::if_else(TRUE, glue("foo"), glue("bar"))
#> Error: `true` must be character, not glue/character

dplyr::case_when(
  TRUE ~ glue("foo")
)
#> Error: must be character, not glue/character



foo <- glue::glue("{1:3}")

class(foo)
#> [1] "glue"      "character"

class(foo[[1]])
#> [1] "character"
Session info
devtools::session_info()
#> Session info -------------------------------------------------------------
#>  setting  value                       
#>  version  R version 3.4.2 (2017-09-28)
#>  system   x86_64, mingw32             
#>  ui       RTerm                       
#>  language (EN)                        
#>  collate  English_United States.1252  
#>  tz       America/New_York            
#>  date     2017-11-05
#> Packages -----------------------------------------------------------------
#>  package    * version    date       source                          
#>  assertthat   0.2.0      2017-04-11 CRAN (R 3.4.0)                  
#>  backports    1.1.0      2017-05-22 CRAN (R 3.4.0)                  
#>  base       * 3.4.2      2017-09-28 local                           
#>  bindr        0.1        2016-11-13 CRAN (R 3.4.0)                  
#>  bindrcpp     0.2        2017-06-17 CRAN (R 3.4.0)                  
#>  compiler     3.4.2      2017-09-28 local                           
#>  datasets   * 3.4.2      2017-09-28 local                           
#>  devtools     1.13.3     2017-08-02 CRAN (R 3.4.2)                  
#>  digest       0.6.12     2017-01-27 CRAN (R 3.4.0)                  
#>  dplyr        0.7.4      2017-09-28 CRAN (R 3.4.2)                  
#>  evaluate     0.10       2016-10-11 CRAN (R 3.4.0)                  
#>  glue       * 1.2.0.9000 2017-11-05 Github (tidyverse/glue@8ad62f1) 
#>  graphics   * 3.4.2      2017-09-28 local                           
#>  grDevices  * 3.4.2      2017-09-28 local                           
#>  htmltools    0.3.6      2017-04-28 CRAN (R 3.4.0)                  
#>  knitr        1.17       2017-08-10 CRAN (R 3.4.1)                  
#>  magrittr     1.5        2014-11-22 CRAN (R 3.4.0)                  
#>  memoise      1.1.0      2017-04-21 CRAN (R 3.4.0)                  
#>  methods    * 3.4.2      2017-09-28 local                           
#>  pkgconfig    2.0.1      2017-03-21 CRAN (R 3.4.0)                  
#>  R6           2.2.2      2017-06-17 CRAN (R 3.4.0)                  
#>  Rcpp         0.12.13    2017-09-28 CRAN (R 3.4.2)                  
#>  rlang        0.1.2      2017-08-09 CRAN (R 3.4.1)                  
#>  rmarkdown    1.6        2017-06-15 CRAN (R 3.4.0)                  
#>  rprojroot    1.2        2017-01-16 CRAN (R 3.4.0)                  
#>  stats      * 3.4.2      2017-09-28 local                           
#>  stringi      1.1.5      2017-04-07 CRAN (R 3.4.0)                  
#>  stringr      1.2.0      2017-02-18 CRAN (R 3.4.0)                  
#>  tibble       1.3.4      2017-08-22 CRAN (R 3.4.1)                  
#>  tools        3.4.2      2017-09-28 local                           
#>  utils      * 3.4.2      2017-09-28 local                           
#>  withr        2.0.0      2017-08-22 Github (jimhester/withr@0c4a86d)
#>  yaml         2.1.14     2016-11-12 CRAN (R 3.4.0)
@psychelzh

This comment has been minimized.

psychelzh commented Jun 18, 2018

I have noticed that there is no public release after this issue being solved. I am wondering when this fix will be released?

psychelzh added a commit to iquizoo/reports that referenced this issue Jun 18, 2018

Fix an error using glue in 'if_else'
This a known issue (tidyverse/dplyr#3109), perhaps solved in a developing version of tidyverse/glue#66. For now, I have to use this workaround.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment