I was unable to run your code; 'fac' is missing and npk$fac in teh 
interaction.plot returns NA.

> data(npk, package="MASS")
> fit <- by(npk, npk$block, function(bydata) fitted.values(lm(yield ~ N,
> data=bydata)))
> fit <- unlist(fit)
> interaction.plot(npk$N, npk$block, fit, xlab="N", 
> ylab="yield") # fake factor, numeric fac <- 
> c(rep(1,12),rep(2,12)) # plots everything in black 
> interaction.plot(npk$N, npk$block, fit, xlab="N", 
> ylab="yield",col=fac)
> cbind(npk$block,fac)
> # plots everything transparent
> fac <- as.factor(fac)
> interaction.plot(npk$N, npk$block, fit, xlab="N",
> ylab="yield",col=as.numeric(npk$fac))

*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}

______________________________________________
R-help@r-project.org 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