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

Set operations fail/crash R session when using CRAN & latest github #903

Closed
mikaelmoutakis opened this issue Jan 18, 2015 · 2 comments
Closed
Assignees

Comments

@mikaelmoutakis
Copy link

@mikaelmoutakis mikaelmoutakis commented Jan 18, 2015

Thanks for all the good work you're doing!

Set operations using data_frames fail.

intersect(alfa,beta)
union(alfa,beta)
setdiff(alfa,beta)

This is the data I'm using.

library(dplyr)
## 
## Attaching package: 'dplyr'
## 
## The following object is masked from 'package:stats':
## 
##     filter
## 
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
alfa <- data_frame(land=c("Sverige","Norway","Danmark","Island","GB"),
                   data=rnorm(length(land)))

beta <- data_frame(land=c("Norge","Danmark","Island","Storbritannien"),
                   data2=rnorm(length(land)))

This is the system I'm using. (I'm using RStudio 0.98.1091). The set operations also crash when using the latest CRAN-version. (Bad!)

library(devtools)
session_info()
## Session info--------------------------------------------------------------
##  setting  value                       
##  version  R version 3.1.2 (2014-10-31)
##  system   x86_64, darwin13.4.0        
##  ui       RStudio (0.98.1091)         
##  language (EN)                        
##  collate  sv_SE.UTF-8                 
##  tz       Europe/Stockholm
## Packages------------------------------------------------------------------
##  package    * version     date       source                          
##  assertthat   0.1         2013-12-06 CRAN (R 3.1.0)                  
##  DBI          0.3.1       2014-09-24 CRAN (R 3.1.1)                  
##  devtools   * 1.6.1       2014-10-07 CRAN (R 3.1.1)                  
##  digest       0.6.8       2014-12-31 CRAN (R 3.1.2)                  
##  dplyr      * 0.4.1.9000  2015-01-18 Github (hadley/dplyr@6382b8f)   
##  evaluate     0.5.5       2014-04-29 CRAN (R 3.1.0)                  
##  formatR      1.0         2014-08-25 CRAN (R 3.1.1)                  
##  htmltools    0.2.6       2014-09-08 CRAN (R 3.1.1)                  
##  knitr      * 1.8         2014-11-11 CRAN (R 3.1.2)                  
##  lazyeval     0.1.10.9000 2015-01-18 Github (hadley/lazyeval@08f5900)
##  magrittr     1.5         2014-11-22 CRAN (R 3.1.2)                  
##  plyr         1.8.1       2014-02-26 CRAN (R 3.1.0)                  
##  Rcpp         0.11.3      2014-09-29 CRAN (R 3.1.1)                  
##  rmarkdown    0.4.2       2014-12-22 CRAN (R 3.1.2)                  
##  rstudio      0.98.1091   2015-01-02 local                           
##  rstudioapi   0.2         2014-12-31 CRAN (R 3.1.2)                  
##  stringr      0.6.2       2012-12-06 CRAN (R 3.1.0)                  
##  yaml         2.1.13      2014-06-12 CRAN (R 3.1.0)
@romainfrancois romainfrancois self-assigned this Apr 20, 2015
@romainfrancois
Copy link
Member

@romainfrancois romainfrancois commented Apr 20, 2015

I'm getting this rather than a crash:

> intersect(alfa,beta)
Erreur : not compatible
> union(alfa,beta)
Erreur : not compatible
> setdiff(alfa,beta)
Erreur : not compatible

I guess not the most useful error message, but no crash.

@romainfrancois
Copy link
Member

@romainfrancois romainfrancois commented Apr 20, 2015

Better now, backed by this test:

test_that("set operation give useful error message. #903", {
  alfa <- data_frame(land=c("Sverige","Norway","Danmark","Island","GB"),
                     data=rnorm(length(land)))

  beta <- data_frame(land=c("Norge","Danmark","Island","Storbritannien"),
                     data2=rnorm(length(land)))
  expect_error( intersect(alfa, beta), "Cols in y but not x" ) 
  expect_error( union(alfa, beta), "Cols in y but not x" )
  expect_error( setdiff(alfa, beta), "Cols in y but not x" )
})

@lock lock bot locked as resolved and limited conversation to collaborators Jun 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants