Skip to content

NA as a factor level malformed by rbindlist #3915

@sindribaldur

Description

@sindribaldur
data.table(V1 = factor(as.character(c(NA, 1:100, NA)), exclude = NULL))
# Error in as.character.factor(x) : malformed factor
data.table(V1 = factor(as.character(c(NA, 1:3, NA)), exclude = NULL))
#      V1
# 1: <NA>
# 2:    1
# 3:    2
# 4:    3
# 5: <NA>

Is this the expected behaviour?

Another example here: https://stackoverflow.com/q/58103098/4552295

I'm getting this result with data.table_1.12.2 and R version 3.6.1.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions