Hi

imagine the following situation:

a <- runif(100)
plot(a[a>0.5])

plots only the elements in the vector which are larger then 0.5

Now imagine a matrix:

b <- matrix(runif(20000), ncol=40, nrow=50)
image(b[b>0.5])
Error in image.default(b[b > 0.5]) : argument must be matrix-like

Is there a similar way then above to plot an image from the matrix with only
the elements larger then 0.5, and the remaining elements equals NA?

I know I could do something like

image(b, zlim=c(0.5, 1))
but this includes 0.5 in the image,

bb <- b
bb[bb<=0.5] <- NA
image(bb)

but this includes an additional assignment.

This is not of practical use at the moment - the question came up when
preparing a lecture.

Rainer


-- 
Rainer M. Krug, Centre of Excellence for Invasion Biology, Stellenbosch
University, South Africa

        [[alternative HTML version deleted]]

______________________________________________
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