From: Andrej Kastrin <andrej.kastrin_at_siol.net>

Date: Mon 06 Feb 2006 - 07:21:20 EST

dotchart(a, cex = 0.9, main = "MeSH Plot", xlab = "frequency",

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 Received on Mon Feb 06 07:32:08 2006

Date: Mon 06 Feb 2006 - 07:21:20 EST

Dead R useRs,

I wrote function, which plot dotchart from given matrix, compute mean from diagonal elements and plot it with abline. In addition, if particular element of matrix is greater then mean value (i.e. mead.diagonal), it should be plot in red, otherwise in green color.

graph <- function(a) {

rownames(a) <- 1:nrow(a) colnames(a) <- 1:ncol(a) mean.diagonal <- mean(a[row(a) == col(a)])par(bg = "gray95")

dotchart(a, cex = 0.9, main = "MeSH Plot", xlab = "frequency",

bg = ifelse((a) > mean.diagonal,"red", "green2"), # !!! pch = 21,labels = rownames(a))abline(v = mean.diagonal, col = "red", lty = 4) }

And now the main problem: I suppose that there is some mismatch in ifelse statement while I produce two totally different plots: first input matrix: A <-matrix(rep(c(1,3,4),3),3,3) # seem that works second input matrix B <-matrix(rnorm(9),3,3) # total confusion between green and red points

Any advice would be appreciated,

Cheers, Andrej

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 Received on Mon Feb 06 07:32:08 2006

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:42:24 EST
*