[R] adding value labels on Interaction Plot

2009-03-04 Thread Dimitri Liakhovitski
Hello - and sorry for what might look like a simple graphics question. I am building an interaction plot for d: d=data.frame(xx=c(3,3,2,2,1,1),yy=c(4,3,4,3,4,3),zz=c(5.1,4.4,3.5,3.3,-1.1,-1.3)) d[[1]]-as.factor(d[[1]]) d[[2]]-as.factor(d[[2]]) print(d) interaction.plot(d$xx, d$yy, d$zz,

Re: [R] adding value labels on Interaction Plot

2009-03-04 Thread Paul Johnson
On Wed, Mar 4, 2009 at 10:52 AM, Dimitri Liakhovitski ld7...@gmail.com wrote: Hello - and sorry for what might look like a simple graphics question. I am building an interaction plot for d: d=data.frame(xx=c(3,3,2,2,1,1),yy=c(4,3,4,3,4,3),zz=c(5.1,4.4,3.5,3.3,-1.1,-1.3))

Re: [R] adding value labels on Interaction Plot

2009-03-04 Thread David Winsemius
See if this helps. After your code, submit this to R: with(d, text(xx[xx==3],zz[xx==3],paste(3, ,zz[xx==3]))) After that has convinced you that xx and zz are being used properly, you can try the more general approach: with(d, text(xx,zz,paste(xx, , , zz))) I would have used ZZ rather

Re: [R] adding value labels on Interaction Plot

2009-03-04 Thread Dimitri Liakhovitski
Thank you, David, however, I am not sure this approach works. Let's try it again - I slightly modifed d to make it more clear: d=data.frame(xx=c(1,1,1,1,2,2,2,2,3,3,3,3),yy=c(3,3,4,4,3,3,4,4,3,3,4,4),zz=c(-1.1,-1.3,0,0.6,-0.5,1,3.3,-1.3,4.4,3.5,5.1,3.5)) d[[1]]-as.factor(d[[1]])

Re: [R] adding value labels on Interaction Plot

2009-03-04 Thread Dimitri Liakhovitski
I'll reply to my own post - to make sure no one wastes his/her time on that. I was able to solve the problem only after I modified the original function interaction.plot (see below). All I did I added one line before the final } - asking it to return the means on the numeric (dependent) variable.