[datatable-help] Mainting key columns after `transform`

Matthew Dowle mdowle at mdowle.plus.com
Thu Mar 31 20:21:08 CEST 2011


Hi,
I don't mind as I don't use transform() or within().
At least, I don't use them directly. Packages I pass
a data.table to might I suppose.
Sounds like a good idea to me though.
Matthew

On Thu, 2011-03-31 at 12:29 -0400, Steve Lianoglou wrote:
> Howdy,
> 
> Would it make sense to change `transform.data.table` to ensure that
> the key columns are maintained after the `transform`-ation?
> 
> My initial thoughts is that this is "fine" (ie. won't break anything)
> as long as none of the columns transformed are elements in the key --
> if they are, I guess it's not clear what to do. One option is to drop
> the keys at this point, another is to add a `.force.keys=TRUE/FALSE`
> argument after the dots, eg:
> 
> transform.data.table <- function(`_data`, ..., .force.keys=TRUE)
> 
> which would reset the key columns to what they were, even if it
> resorts the data.table.
> 
> Thoughts?
> 
> -steve
> 
> btw - and I guess whatever makes sense to do here would also make
> sense to do in the `within.data.table` function as well.
> 
> 




More information about the datatable-help mailing list