Re: [R] Creating vegetation distance groups from one column

2012-10-06 Thread Rui Barradas
Hello, My example with 'x' was just that, an example. Inline. Em 06-10-2012 00:03, Jhope escreveu: Hi, I have tried the script posted but received the following errors. I hope I copied it correctly. I'm sorry but I don't know how to alter the script myself. Please advise, Jean x <- 0:30 + r

Re: [R] Creating vegetation distance groups from one column

2012-10-05 Thread Jhope
Hi, I have tried the script posted but received the following errors. I hope I copied it correctly. I'm sorry but I don't know how to alter the script myself. Please advise, Jean > x <- 0:30 + runif(124) > data.to.analyze$VegIndex <- cut(x, breaks = seq(0, 35, 5)) Error in `$<-.data.frame`(`*tm

Re: [R] Creating vegetation distance groups from one column

2012-10-05 Thread Jhope
Hi Thanks to all for posting! In plyr I did try something similar, a combination of what I learned from all who replied. It seemed to work. If anyone knows of any criticism about the grouping structure please let me know. I need this to be accurate. Grouping defined by (0-5m) (6-10m) (11-15m) (16

Re: [R] Creating vegetation distance groups from one column

2012-10-05 Thread Rui Barradas
Hello, That now seems to be a presentation problem. See this example: x <- 0:30 + runif(124) y <- cut(x, breaks = seq(0, 35, 5)) l <- levels(y) l1 <- sub("\\]", ")", l[1]) l2 <- as.numeric(sub("\\(([[:digit:]]+),.*", "\\1", l[-1])) + 1 l3 <- sub(".*,([[:digit:]]+).*", "\\1", l[-1]) l.new <- c(

Re: [R] Creating vegetation distance groups from one column

2012-10-05 Thread arun
From: Jhope To: r-help@r-project.org Cc: Sent: Friday, October 5, 2012 3:38 AM Subject: Re: [R] Creating vegetation distance groups from one column Thank you! That has worked for me when creating graphs. In plyr I used the script: # Veg Index data.to.analyze$VegIndex <- cut(data.to.analyze$Veg,

Re: [R] Creating vegetation distance groups from one column

2012-10-05 Thread Jhope
Thank you! That has worked for me when creating graphs. In plyr I used the script: # Veg Index data.to.analyze$VegIndex <- cut(data.to.analyze$Veg, breaks=seq(0, 35, 5), include.lowest=TRUE) VegIndex <- data.to.analyze$VegIndex plot(VegIndex) But the vegetation distances on the x-axis in t

Re: [R] Creating vegetation distance groups from one column

2012-10-04 Thread Jean V Adams
Try this data.to.analyze$VegIndex <- cut(data.to.analyze$Veg, breaks=seq(0, 70, 5), include.lowest=TRUE) plot(data.to.analyze$VegIndex) Jhope wrote on 10/04/2012 02:25:09 PM: > > Hi, > > Allow me to recap my question. In plyr I am trying to group distances of > nests to the vegetati

Re: [R] Creating vegetation distance groups from one column

2012-10-04 Thread Jhope
Hi, Allow me to recap my question. In plyr I am trying to group distances of nests to the vegetation into classes that are defined by (0-5m, 6-10m, 11-15m, 16-20m, 21-25m, 26-30m, 31-35m). Each row is a nest and all the distances to the vegetation is in a column. As well I would like to create c

Re: [R] Creating vegetation distance groups from one column

2012-10-04 Thread Rui Barradas
Hello, Without sample data it's difficult to give an answer but see ?cut. To give a data example, the best way is to use ?dput(). dput( head(mydata, 30) ) # Paste the output of this in a post Hope this helps, Rui Barradas Em 04-10-2012 08:27, Jhope escreveu: Hi R listers, I am trying to gro

Re: [R] Creating vegetation distance groups from one column

2012-10-04 Thread Jean V Adams
Jean, Take a look at the cut() function, ?cut For example ... mydf <- data.frame(nest=1:100, d2veg=runif(100, 0, 60)) mydf$dgroup <- cut(mydf$d2veg, breaks=seq(0, 70, 5), include.lowest=TRUE) head(mydf) (another) Jean Jhope wrote on 10/04/2012 02:27:38 AM: > > Hi R listers, > > I am tryi

[R] Creating vegetation distance groups from one column

2012-10-04 Thread Jhope
Hi R listers, I am trying to group distances of nests to the vegetation into classes that are define by (0-5m, 6-10m, 11-15m, 16-20m, 21-25m, 26-30m, 31-35m, 36-40m, 41-45m, 46-50m, 51-55m, 56-60m). Each row is a nest and all the distances to the vegetation is in a column. In plyr, I have trie