> -----Original Message----- > From: [email protected] > [mailto:[email protected]] On > Behalf Of Karl Ove Hufthammer > Sent: Thursday, April 14, 2011 07:58 > To: [email protected] > Cc: [email protected] > Subject: Re: [datatable-help] Using a data.table to perform a > two-way lookup > > On Thu, 14 Apr 2011 09:02:08 +0100, Matthew Dowle > <[email protected]> > wrote: > > On Wed, 2011-04-13 at 04:04 -0700, Karl Ove Hufthammer wrote: > >> I've tried to come up with a similar generated dataset and example > code. > >> The result is much faster than similar code on my real > data set, but > >> still shows (using 'Rprof') that 'levels<-' is the main > bottle-neck, > >> as > about > >> one third of the time is spent there. Here's the code. > I've included > both > >> a tiny example to show how the function is supposed to work, and a > larger > >> and slower example (which is still pretty fast, about > thirty seconds > >> on my computer):
If you want to shave that 1/3 off, you can convert your factor columns to integers, do your processing, then manually reapply factor levels when your processing is all done. - Tom _______________________________________________ datatable-help mailing list [email protected] https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
