Assuming this data frame:
DF <- data.frame(X = c(36.435, 36.435, 36.435, 35.329, 35.329,
36.431, 36.431, 35.421, 35.421, 35.421), Y = c(30.118, 30.118,
30.118, 29.657, 29.657, 30.111, 30.111, 29.797, 29.797, 29.797))
# Try this:
DF$site <- as.numeric(factor(interaction(DF$X, DF$Y)))
If X and Y ca
Henrique Dallazuanna wrote:
> Try this:
>
> x2 <- merge(x, cbind(unique(x), Site=sprintf("S%d",
> seq_len(nrow(unique(x), by=c("X", "Y"))
> x2[order(x2$site)]
>
That was (close to) my first thought as well. But what about
site <- with(x, interaction(X,Y, drop=TRUE))
levels(site) <- paste("S
Try this:
x2 <- merge(x, cbind(unique(x), Site=sprintf("S%d",
seq_len(nrow(unique(x), by=c("X", "Y"))
x2[order(x2$site)]
On 11/02/2008, Weidong Gu <[EMAIL PROTECTED]> wrote:
> HI,
>
>
>
> I am working on a data set with multiple collections of mosquitoes at
> sampling sites. Each row represen
3 matches
Mail list logo