From: Stefan Evert <stefan.evert_at_uos.de>

Date: Mon, 28 Jul 2008 20:07:04 +0200

R-help_at_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. Received on Mon 28 Jul 2008 - 18:42:55 GMT

Date: Mon, 28 Jul 2008 20:07:04 +0200

And you may want to consider using the 'cut' function. In your case, something like

veg_mean <- cut(veg_mean, breaks=c(0,.1,1,2,5,10,25,50,75,95,100), right=FALSE)

should do the trick (see ?cut for more options).

Best,

Stefan

On 28 Jul 2008, at 19:52, Henrik Bengtsson wrote:

> Use '&' for vectors and '&&' for scalars. Ditto applies to the OR

*> operator(s). /Henrik
**>
**> On Mon, Jul 28, 2008 at 10:36 AM, Wade Wall <wade.wall_at_gmail.com>
**> wrote:
**>> Hi all,
**>>
**>> I am trying to convert geometric means in a matrix to cover
**>> classes. My
**>> values are as such:
**>>
**>> perc<-c(0,0.025136418, 0.316227766, 1.414213562,3.16227766,
**>> 7.071067812,
**>> 15.8113883, 35.35533906, 61.23724357, 84.40971508, 97.46794345)
**>> cover<-c(0,1,2,3,4,5,6,7,8,9,10)
**>>
**>> This is what I am trying to accomplish
**>>
**>> veg_mean[veg_mean>0 && veg_mean < .1] <- 1
**>> veg_mean[veg_mean>= .1 && veg_mean < 1.0] <- 2
**>> veg_mean[veg_mean>=1.0 && veg_mean < 2.0] <- 3
**>> veg_mean[veg_mean>=2.0 && veg_mean < 5.0] <- 4
**>> veg_mean[veg_mean>= 5.0 && veg_mean < 10.0] <- 5
**>> veg_mean[veg_mean>= 10.0 && veg_mean < 25] <- 6
**>> veg_mean[veg_mean>= 25.0 && veg_mean < 50.0] <- 7
**>> veg_mean[veg_mean>=50.0 && veg_mean < 75.0] <- 8
**>> veg_mean[veg_mean>= 75.0 && veg_mean < 95.0 ] <- 9
**>> veg_mean[veg_mean>= 95.0 && veg_mean <= 100] <- 10
**>> veg_mean[veg_mean> 100] <- NA
*

R-help_at_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. Received on Mon 28 Jul 2008 - 18:42:55 GMT

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.2.0, at Mon 28 Jul 2008 - 19:32:47 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*