Dear all

Hopefully somebody will know the answer.

I have some list

x <- data.frame(a = 1:9, beta = exp(-4:4), logic = rep(c(TRUE,FALSE), 
c(5,4)))
x.l <- split(x, x$logic)
plot(x.l$a, x.l$beta)

and I want to plot lines color coded according to logic variable

lapply(x.l, function(x, ...) lines(x$a, x$beta, col=1:2))
lapply(x.l, function(x,...) lines(x$a,x$beta), col=1:2)
lapply(x.l, function(x,...) lines(x$a,x$beta, ...), col=1:2)

Well, lapply seems to ignore my best attempts to persuade it to use 
different colours for each part of x.l list.

Anybody knows how to code different colours when using lapply for 
such plotting?

At present time I use a loop but maybe lapply could do it too.

Best regards.
Petr

Petr Pikal
[EMAIL PROTECTED]

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to