Skip to content

String coercion inserts spaces, as.matrix.data.table #4209

Description

@alistaire47

When coercing from a data.table to a matrix and types are coerced (yes this is bad and shouldn't be done, so this is definitely low-priority), a data.table inserts spaces whereas a data.frame does not:

> as.matrix(data.frame(a = LETTERS[1:2], b = c(FALSE, TRUE)))
     a   b      
[1,] "A" "FALSE"
[2,] "B" "TRUE" 
> as.matrix(data.table(a = LETTERS[1:2], b = c(FALSE, TRUE)))
     a   b      
[1,] "A" "FALSE"
[2,] "B" " TRUE"

I assume this is a result of C++ typing somehow, but I don't know enough to make a PR, sorry.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions