adibender / coalitions

Coalition probabilities in multi-party democracies
https://adibender.github.io/coalitions/
Other
21 stars 4 forks source link

Error when using dplyr 0.7.1 #29

Closed bauer-alex closed 7 years ago

bauer-alex commented 7 years ago

Using coalitions::get_surveys() with dplyr v0.7.1 throws an error: Evaluation error: Variable context not set

The error comes from gather(..., one_of(av.parties)) in collapse_parties.

I don't know how to solve the error with one_of(). My current workaround is to use cdu:sonstige instead of the one_of() argument

bauer-alex commented 7 years ago

Okay no, cdu:sonstige obviously makes something else than one_of(...) should do...

bauer-alex commented 7 years ago

Ok, issue closed for now. Somehow this only happened with the 0.7.1 version installed from github, but the official release 0.7.1 (using install.packages()) seemingly doesn't lead to the error.

bauer-alex commented 7 years ago

I'm so sorry, I have to reopen it. :P The problem DOES remain in the official non-GitHub version.

adibender commented 7 years ago

strange, works for me:

surveys <- get_surveys()
surveys
### A tibble: 7 x 2
##   institute            surveys
##       <chr>             <list>
##1 allensbach  <tibble [32 x 5]>
##2      emnid <tibble [190 x 5]>
##3      forsa <tibble [194 x 5]>
##4        fgw  <tibble [67 x 5]>
##5        gms  <tibble [88 x 5]>
##6  infratest  <tibble [89 x 5]>
##7       insa  <tibble [99 x 5]>

devtools::session_info()                                                                                                              
##Session info ----------------------------------------------------------------------------------------------------------
## setting  value                       
## version  R version 3.4.0 (2017-04-21)
## system   x86_64, linux-gnu           
## ui       X11                         
## language en                          
## collate  en_US.UTF-8                 
## tz       Europe/Berlin               
## date     2017-07-01                  
##
##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.0      2017-04-21 local                                
## bindr        0.1        2016-11-13 cran (@0.1)                          
## bindrcpp   * 0.2        2017-06-17 CRAN (R 3.4.0)                       
## checkmate    1.8.2      2016-11-02 CRAN (R 3.4.0)                       
## coalitions * 0.2.0      2017-06-30 Github (adibender/coalitions@095c57e)
## compiler     3.4.0      2017-04-21 local                                
## curl         2.6        2017-04-27 CRAN (R 3.4.0)                       
## datasets   * 3.4.0      2017-04-21 local                                
## devtools     1.13.2     2017-06-02 CRAN (R 3.4.0)                       
## digest       0.6.12     2017-01-27 CRAN (R 3.4.0)                       
## dplyr        0.7.1      2017-06-22 CRAN (R 3.4.0)                       
## glue         1.1.1      2017-06-21 CRAN (R 3.4.0)                       
## graphics   * 3.4.0      2017-04-21 local                                
## grDevices  * 3.4.0      2017-04-21 local                                
## gtools       3.5.0      2015-05-29 CRAN (R 3.4.0)                       
## httr         1.2.1      2016-07-03 CRAN (R 3.4.0)                       
## lubridate    1.6.0      2016-09-13 CRAN (R 3.4.0)                       
## 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.0      2017-04-21 local                                
## pkgconfig    2.0.1      2017-03-21 cran (@2.0.1)                        
## plyr         1.8.4      2016-06-08 CRAN (R 3.4.0)                       
## purrr        0.2.2.9000 2017-06-30 Github (tidyverse/purrr@9cd05b9)     
## R6           2.2.1      2017-05-10 cran (@2.2.1)                        
## Rcpp         0.12.11    2017-05-22 CRAN (R 3.4.0)                       
## reshape2     1.4.2      2016-10-22 CRAN (R 3.4.0)                       
## rlang        0.1.1      2017-05-18 cran (@0.1.1)                        
## rvest        0.3.2      2016-06-17 CRAN (R 3.4.0)                       
## selectr      0.3-1      2016-12-19 CRAN (R 3.4.0)                       
## stats      * 3.4.0      2017-04-21 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.3      2017-05-31 Github (tidyverse/tibble@b2275d5)    
## tidyr        0.6.3      2017-05-15 cran (@0.6.3)                        
## tools        3.4.0      2017-04-21 local                                
## utils      * 3.4.0      2017-04-21 local                                
## withr        1.0.2      2016-06-20 CRAN (R 3.4.0)                       
## XML          3.98-1.7   2017-05-03 CRAN (R 3.4.0)                       
## xml2         1.1.1      2017-01-24 CRAN (R 3.4.0)      
bauer-alex commented 7 years ago

Weird... Es funktioniert nämlich weder auf meinem Laptop noch am Linux-Server. Habs für mich fixen können, indem ich gather(surveys, party, percent, one_of(av.parties)) durch gather(surveys, party, percent, select_vars(names(surveys),one_of(av.parties))) ersetzt hab in collapse_parties(). Könnte nen Pull request machen wenn du willst.

bauer-alex commented 7 years ago

Hier die sessionInfo von meinem Mac: (vorab: wie kommentiert man das Folgende eigentlich als so schönen Kasten wie bei dir oben aus?)

devtools::session_info()
Session info -----------------------------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.3.2 (2016-10-31)
 system   x86_64, darwin13.4.0        
 ui       RStudio (1.0.136)           
 language (EN)                        
 collate  de_DE.UTF-8                 
 tz       Europe/Berlin               
 date     2017-07-01                  

Packages ---------------------------------------------------------------------------------------------------------------------------
 package    * version    date       source                               
 assertthat   0.2.0      2017-04-11 cran (@0.2.0)                        
 base       * 3.3.2      2016-10-31 local                                
 bindr        0.1        2016-11-13 cran (@0.1)                          
 bindrcpp   * 0.2        2017-06-17 cran (@0.2)                          
 datasets   * 3.3.2      2016-10-31 local                                
 devtools     1.13.2     2017-06-02 CRAN (R 3.3.2)                       
 digest       0.6.12     2017-01-27 cran (@0.6.12)                       
 dplyr      * 0.7.1      2017-06-22 CRAN (R 3.3.2)                       
 glue         1.1.1      2017-06-21 cran (@1.1.1)                        
 graphics   * 3.3.2      2016-10-31 local                                
 grDevices  * 3.3.2      2016-10-31 local                                
 magrittr     1.5        2014-11-22 CRAN (R 3.3.0)                       
 memoise      1.0.0      2016-01-29 CRAN (R 3.3.0)                       
 methods    * 3.3.2      2016-10-31 local                                
 pkgconfig    2.0.1      2017-03-21 cran (@2.0.1)                        
 purrr      * 0.2.2.9000 2017-07-01 Github (hadley/purrr@9cd05b9)        
 R6           2.2.2      2017-06-17 cran (@2.2.2)                        
 Rcpp         0.12.11    2017-05-22 cran (@0.12.11)                      
 rlang        0.1.1      2017-05-18 cran (@0.1.1)                        
 stats      * 3.3.2      2016-10-31 local                                
 tibble       1.3.3      2017-05-28 cran (@1.3.3)                        
 tidyr      * 0.6.3.9000 2017-07-01 Github (hadley/tidyr@34100ed)        
 tidyselect   0.0.0.9000 2017-07-01 Github (tidyverse/tidyselect@877968c)
 tools        3.3.2      2016-10-31 local                                
 utils      * 3.3.2      2016-10-31 local                                
 withr        1.0.2      2016-06-20 CRAN (R 3.3.0) 
adibender commented 7 years ago

also für das highlighting, machst du ähnlich wie rmd files "```r" am Anfang und "```" am Ende, jeweils in separaten zeilen. Die Auskommentierung habe ich Editor hinzugefügt, habe dafür short cuts