>But I don't want to plot random colors.
>...
> That's why I have this vector with length 24 - each one matches one line in
> the "npk" dataset.
... which is not what interaction.plot, or matplot, needs; it needs one per
line on the plot.
>How can I inform to the interaction.plot function the co
Iuri:
Your code as emailed reads:
##
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)) # plot
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="y
3 matches
Mail list logo