Re: [R] Can I get rid of this for loop using apply?

From: hadley wickham <>
Date: Thu, 24 Apr 2008 09:24:15 -0500

> Great suggestions. I tested the code on an example and the run time was
> reduced from 1 min 12 sec to 3 sec. Also, I like the suggestion to look at
> the quantiles. I will see what insight it provides in terms of detecting
> masked interactions.

Well that's a decent speed up :)

> I have a couple questions about your code.
> First, why not use
> xs <- seq(min(x1), max(x1), length = 100) instead of
> xs <- with(m, seq(min(x1), max(x1), length = 100)) ?

No real reason, just to make it a bit easier when you generalise to other data sets / models

> Second, what is the function geom_line()? I couldn't find it.

It's in ggplot2 - - ?geom_line should find it too though (provided you have version 0.6 of ggplot2)



______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Thu 24 Apr 2008 - 15:16:44 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 24 Apr 2008 - 15:30:31 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive