Skip to content
Prev 307056 / 398506 Next

Creating vegetation distance groups from one column

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(l1, paste0("(", l2, ",", l3, ")"))
levels(y) <- l.new

str(y)
barplot(table(y))


Instead of 'y' use data.to.analyze$VegIndex and it should give what you 
want.

Hope this helps,

Rui Barradas
Em 05-10-2012 08:38, Jhope escreveu: