[R] Dividing a pixel image into factors - (cut.im(), cut.default())
Rolf Turner
r.turner at auckland.ac.nz
Sun Dec 6 22:01:44 CET 2009
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}}
More information about the R-help
mailing list