Skip to content

error in right_join when both by variables have label attributes #1636

@rkingdc

Description

@rkingdc

I'm getting the error:

Error: cannot join on columns 'i' x 'i': Can't join on 'i' x 'i' because of incompatible types (numeric / numeric)

When the by variable i from both datasets have a label attribute pulled in from haven::read_sas.

Reproducible example via attached .sas7bdat files:

options(stringsAsFactors=FALSE)
library(haven)
library(dplyr)

tbl_right <- read_sas('right.sas7bdat')
tbl_left  <- read_sas('left.sas7bdat')

right_join(tbl_right, tbl_left, by='i')

attr(tbl_right$i, 'label') <- NULL
attr(tbl_left$i, 'label') <- NULL

right_join(tbl_right, tbl_left, by='i')
> sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] dplyr_0.4.3 haven_0.2.0

loaded via a namespace (and not attached):
[1] assertthat_0.1 DBI_0.3.1      magrittr_1.5   parallel_3.1.2 R6_2.1.0       Rcpp_0.11.6   
[7] tools_3.1.2

example_files.zip

Metadata

Metadata

Labels

featurea feature request or enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions