Skip to content

Negative select in fread #2423

Description

@MichaelChirico
fread('v1,v2,v3,v4,v5\n1,2,3,4,5', select = -1L)

Error in fread("v1,v2,v3,v4,v5\n1,2,3,4,5", select = -1L) :
Column number -1 (select[1]) is out of range [1,ncol=5]

Seems natural enough to allow negative selection as elsewhere in R & [.data.table

Expected output

data.table(V2 = 2, V3 = 3, V4 = 4, V5 = 5)
#    V2 V3 V4 V5
# 1:  2  3  4  5

Activity

  1. MichaelChirico commented on Oct 17, 2017

    @MichaelChirico
    MemberAuthor

    Hmm, of course there's drop. Perhaps a nudge message ("Are you sure you didn't mean drop = ..." when select is all negative), or automatically flipping select to drop (and vice versa) when all indices are negative...

  2. added this to the milestone on Oct 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions