Skip to content

[R-Forge #5372] dropping the last column deletes all rows #52

@arunsrinivasan

Description

@arunsrinivasan

Submitted by: Malcolm Cook; Assigned to: Nobody; R-Forge link

I find that the data.table does NOT behave like data.frame in the case of with=FALSE and selecting no columns.

data.frame will retain empty columns whereas data.table will drop them.

viz:

data.frame(x=1:10)
x
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
data.frame(x=1:10)[,-1]
data frame with 0 columns and 10 rows
data.table(x=1:10)
x
1: 1
2: 2
3: 3
4: 4
5: 5
6: 6
7: 7
8: 8
9: 9
10: 10
data.table(x=1:10)[,-1,with=FALSE]
Null data.table (0 rows and 0 cols)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions