[datatable-help] CJ and setkey sort differently

Arunkumar Srinivasan aragorn168b at gmail.com
Fri Feb 14 22:43:00 CET 2014


Here: https://r-forge.r-project.org/tracker/?atid=975&group_id=240&func=browse
You've to create an account, but that's super easy.
Arun
From: Malcolm Hawkes Malcolm Hawkes
Reply: Malcolm Hawkes mhawkes at gcmlp.com
Date: February 14, 2014 at 10:42:07 PM
To: Arunkumar Srinivasan aragorn168b at gmail.com, datatable-help at lists.r-forge.r-project.org datatable-help at lists.r-forge.r-project.org
Subject:  RE: [datatable-help] CJ and setkey sort differently  
Arun

 

Oops, yes it should.  And vec1 <- c("Corp", "CORP")

 

Took me while to track down, what was causing but got it in the end J

 

Where / how do I file a bug report ?

 

Thanks

 

Malcolm

 

Malcolm Hawkes

On-Site Consultant, Investments - RiskManagement

Grosvenor Capital Management, L.P.

900 N. Michigan Avenue, Suite 1100

Chicago, IL  60611

mhawkes at gcmlp.com

 

From: Arunkumar Srinivasan [mailto:aragorn168b at gmail.com]
Sent: Friday, February 14, 2014 3:38 PM
To: datatable-help at lists.r-forge.r-project.org; Malcolm Hawkes
Subject: Re: [datatable-help] CJ and setkey sort differently

 

Malcolm,

 

Thanks for the nice report. I suppose your `dt` creation should be: `dt <- CJ(vec1, vec2)`. The reason is pretty clear. It's an easy fix. Could you please file a bug report? Thank you.

 

Arun

From: Malcolm HawkesMalcolm Hawkes
Reply: Malcolm Hawkesmhawkes at gcmlp.com
Date: February 14, 2014 at 10:34:21 PM
To: datatable-help at lists.r-forge.r-project.orgdatatable-help@lists.r-forge.r-project.org
Subject:  [datatable-help] CJ and setkey sort differently

Ran in to the warning

 

Warning in setkeyv(x, cols, verbose = verbose) :

  Already keyed by this key but had invalid row order, key rebuilt. If you didn't go under the hood please let datatable-help know so the root cause can be fixed.

 

You can reproduce it with

vec1 <- c("CMDTY", "Copper", "CORPOAS")

vec2 <-  1:3

dt <- CJ(vec1, Date)

setkey(dt, V1, V2)

 

Issue seems to be that CJ (..., sorted = TRUE) and setkey want to sort the character data in different orders, one case-sensitive, one not.

 

CJ creates

 

     V1 V2

1: Corp  1

2: Corp  2

3: Corp  3

4: CORP  1

5: CORP  2

6: CORP  3

 

And it’s keyed as you would expect by V1 then V2

>key(dt)

[1] "V1" "V2"

 

 

But after doing setkey you have

 

     V1 V2

1: CORP  1

2: CORP  2

3: CORP  3

4: Corp  1

5: Corp  2

6: Corp  3

 

 

 

data.table version 1.8.10

 

> R.version

               _                          

platform       x86_64-w64-mingw32         

arch           x86_64                     

os             mingw32                    

system         x86_64, mingw32            

status                                    

major          3                          

minor          0.2                        

year           2013                       

month          09                         

day            25                         

svn rev        63987                      

language       R                          

version.string R version 3.0.2 (2013-09-25)

nickname       Frisbee Sailing            

> 

 

 

Malcolm Hawkes

On-Site Consultant, Investments - RiskManagement

Grosvenor Capital Management, L.P.

900 N. Michigan Avenue, Suite 1100

Chicago, IL  60611

mhawkes at gcmlp.com

 

 

 

---

 

Disclosure and Statement of Confidentiality

 

 

Grosvenor Securities LLC, Member FINRA, Serves as Placement Agent or Distributor for Certain Investment Products Managed/Advised by GCM Grosvenor-Affiliated Entities.

 

 

The contents of this e-mail message and its attachments (if any) may be proprietary and/or confidential and are intended solely for the addressee(s) hereof. In addition, this e-mail message and its attachments (if any) may be subject to non-disclosure or confidentiality agreements or applicable legal privileges, including privileges protecting communications between attorneys or solicitors and their clients or the work product of attorneys and solicitors. If you are not the named addressee, or if this e-mail message has been addressed to you in error, please do not read, disclose, reproduce, distribute, disseminate or otherwise use this message or any of its attachments. Delivery of this e-mail message to any person other than the intended recipient(s) is not intended in any way to waive privilege or confidentiality. If you have received this e-mail message in error, please alert the sender by reply e-mail; we also request that you immediately delete this e-mail message and its attachments (if any). Grosvenor Capital Management, L.P., GCM Customized Fund Investment Group, L.P. and their affiliated entities (collectively, “GCM Grosvenor”) reserve the right to monitor all e-mail communications through their networks. GCM Grosvenor gives no assurances that this e-mail message and its attachments (if any) are free of viruses and other harmful code.

_______________________________________________
datatable-help mailing list
datatable-help at lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20140214/9bd4b0e6/attachment-0001.html>


More information about the datatable-help mailing list