[R] Can I get rid of this for loop using apply?
    hadley wickham 
    h.wickham at gmail.com
       
    Thu Apr 24 16:24:15 CEST 2008
    
    
  
> 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 - http://had.co.nz/ggplot2/geom_line.html  -
?geom_line should find it too though (provided you have version 0.6 of
ggplot2)
Hadley
-- 
http://had.co.nz/
    
    
More information about the R-help
mailing list