Skip to content

print.data.table warns when options(datatable.show.indices=TRUE) and an index exists #6806

@aitap

Description

@aitap

Observed while reading the source("data.table-Ex") output for translation purposes; taken from example(print.data.table):

library(data.table)
options(warn = 2, datatable.show.indices=TRUE)
NN <- 200
DT = data.table(grp1 = sample(100, NN, TRUE), grp2 = sample(90, NN, TRUE), grp3 = sample(80, NN, TRUE))
setindex(DT, grp1, grp3) # will warn during printing after this but not before
DT
# Index: <grp1__grp3>
# Error in rbind(abbs, toprint) : 
#   (converted from warning) number of columns of result is not a multiple of vector length (arg 1)

The warning most likely originates here:

toprint = rbind(abbs, toprint)

May be a good exercise in finding the emergency exit from R Inferno. If not, will debug myself soon.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions