Skip to content

rbind functions are too strict about types #321

@otsaw

Description

@otsaw
> rbind_list(data.frame(x=1:3), data.frame(x=NA))
Error: incompatible type (data index: 2, column: 'x', was collecting: integer (dplyr::Collecter_Impl<13>), incompatible with data of type: LGLSXP

This works the other way around.

> rbind_list(data.frame(x=NA), data.frame(x=1:3))
   x
1 NA
2  1
3  2
4  3

Integer promotion to numeric doesn't work either way.

I understand if some strictness is a necessary consequence of a speecy C-implementation. However, if possible, there are at least two harmless promotions that I'd expect to happen automatically.

  1. Logical due to all NAs should get promoted to whatever type another piece with actual data has.
  2. Integers should get promoted to numeric.

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