Thanks for correction!

2011/11/7 Matthew Dowle <[email protected]>

> On Mon, 2011-11-07 at 10:47 -0600, Branson Owen wrote:
> >
> >
> >         On Fri, Nov 4, 2011 at 9:15 AM, Chris Neff <[email protected]>
> >         wrote:
> >         > I'd rather have the print.data.table function override the
> >         > print.data.frame one. How can I do this?
> >
> >         Try:
> >
> >         print.data.frame <- data.table:::print.data.table
> >
> >
> > Does it create a copy of 'print.data.frame' in global environment?
>
> A copy of print.data.table, yes. It might be a copy-on-write, not sure.
>
> > > base:::print.data.frame <- data.table:::print.data.table
>
> That doesn't work, does it?
>

Oops, no. Shouldn't post my 'guess' before I even try it by myself.

>
> > If print.data.frame is always called in global environment, I guess I
> > worried too much.
>
> Are you thinking about speed here?  .GlobalEnv is always pos 1 on
> search() so those functions are found quickest. base is last on search()
> so they're actually slower if repeated many times in a loop, due to
> searching() for them.  I think compile()'d code might save the location
> in the byte code, to save the searching()ing, not sure.
>
>
Interesting! I posted that problematic suggestion is because it worked for
me in other case before. I was trying to overwrite data.table's default
argument: 'nomatch' = 0 instead of NA. I can't find a smart way to do it,
and I end up with overwrite whole data.table function. At that time,
data.table.fn <- function() {...} is not enough. I found that I need to add
scope operator ::: to overwrite internal function.

Thanks again for the correction!
_______________________________________________
datatable-help mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help

Reply via email to