On 4/12/2009, at 10:10 PM, Gough Lauren wrote:
Hi,
I have a numeric pixel image which I would like to divide into factors
for analysis in Spatstat. I have found that I can use cut.im()
function
to divide the range of pixel values into a series of equal length
intervals (e.g. if my pixels values range from 0 to 60,
cut.im(X.im,breaks=2) will produce two factors one containing pixel
values 0-30 and one containing pixel values of 30 - 60, or
thereabouts).
However, I would like to specify the pixel value at which the factors
are created - e.g. create one factor containing pixel values of 0-5
and
another factor containing all other pixel values.
I think you mean a factor with two ***levels***, one encompassing
values from 0 to 5, the other encompassing values from 5 to 60.
I have been
struggling to work out how to do this using either cut.im() or
cut.default(). Can anyone help?
Unless I'm terribly confused, the obvious solution to your question is:
cut.im(X.im,breaks=c(0,5,60))
Uhhh, why was this difficult?
cheers,
Rolf Turner
######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}
______________________________________________
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.