Skip to content

rbind with labelled variables (imported with Hmisc) generates an error #1549

@alexkowa

Description

@alexkowa

When calling rbind on 2 data sets with common and new variables, having "labelled" variables in one of the data sets generates an error in rbind. Interestingly, the order of data sets does matter. The functions spss.get in Hmisc generates such variables.

require(data.table);require(Hmisc)
## Generate a labeled numeric
x <- c(1:2)
label(x) <- c("a")

## Generate two data.tables with 1 overlapping and 1 new column x
d1 <- data.table(v1=1:2,x=x)
d2 <- data.table(v1=3:4)

#does not work!?
rbind(d2,d1,fill=TRUE)

#this order works
rbind(d1,d2,fill=TRUE)

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions