Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select is not selecting in the same order #2986

Closed
privefl opened this issue Jul 26, 2018 · 3 comments
Closed

Select is not selecting in the same order #2986

privefl opened this issue Jul 26, 2018 · 3 comments
Milestone

Comments

@privefl
Copy link

@privefl privefl commented Jul 26, 2018

When selecting c(5, 1, 3) from a file containing iris, I expected to have Species first.

> library(data.table)

> fwrite(iris, tmp <- tempfile())

> fread(file = tmp, select = c(5, 1, 3), skip = 0)
     Petal.Length   Species Sepal.Length
  1:          1.4    setosa          5.1
  2:          1.4    setosa          4.9
  3:          1.3    setosa          4.7
  4:          1.5    setosa          4.6
  5:          1.4    setosa          5.0
 ---                                    
146:          5.2 virginica          6.7
147:          5.0 virginica          6.3
148:          5.2 virginica          6.5
149:          5.4 virginica          6.2
150:          5.1 virginica          5.9

> fread(file = tmp, select = c(5, 1, 3), skip = 1)
      V3        V5  V1
  1: 1.4    setosa 5.1
  2: 1.4    setosa 4.9
  3: 1.3    setosa 4.7
  4: 1.5    setosa 4.6
  5: 1.4    setosa 5.0
 ---                  
146: 5.2 virginica 6.7
147: 5.0 virginica 6.3
148: 5.2 virginica 6.5
149: 5.4 virginica 6.2
150: 5.1 virginica 5.9
@MichaelChirico
Copy link
Member

@MichaelChirico MichaelChirico commented Jul 26, 2018

Hmm, I thought this was an issue that was closed already...

@MichaelChirico
Copy link
Member

@MichaelChirico MichaelChirico commented Jul 26, 2018

Yes, #1445. The examples in that issue work as expected...

@MichaelChirico
Copy link
Member

@MichaelChirico MichaelChirico commented Jul 26, 2018

Hmm, I think maybe the code is broken. I guess order(select) should be replaced by frank(select).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants