Paul Roebuck <[EMAIL PROTECTED]> writes:

> Is there a canonical means to apply a function
> over multiple arrays simultaneously? For example,
> if I wanted to plot each line with a different color?
> Or is a for loop conversion my best option?

Try looking at matplot() and friends...
 
> 
> x <- seq(0, 8, by = 2)
> y <- matrix(1:15, nrow = 5, byrow = TRUE)
> my.colors <- heat.colors(3)
> 
> drawLines <- function(row) {
>     lines(x, row)    # want corresponding 'my.colors' here
> }
> 
> plotData <- function(x, y) {
>     plot(x, type='n', axes = FALSE,
>          xlim = c(min(x), max(x)),
>          ylim = c(0, max(y)));
>     box();
>     axis(1, min(x):max(x))
>     axis(2, seq(0, max(y), by = 5))
>     axis(3, labels = FALSE)
>     axis(4, labels = FALSE)
>     apply(y, 1, drawLines)
> }
> 
> plotData(x, t(y))
> 
> ----------------------------------------------------------
> SIGSIG -- signature too long (core dumped)
> 
> ______________________________________________
> [EMAIL PROTECTED] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - ([EMAIL PROTECTED])             FAX: (+45) 35327907

______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to