The OP indicated that the middle group should be closed on both ends, i.e.
[0.1, 0.6].
> dat2 <- rbind(dat, 0.1, 0.6)
> dat2$group <- factor(ifelse(dat2$Var<.1, "A", ifelse(dat2$Var>.6, "C",
"B")))
> dat2
Var group
1 0.0 A
2 0.2 B
3 0.5 B
4 1.0 C
5 4.0 C
6 6.0 C
7 0.1 B
8 0.6 B
Does it but would be clumsy for more than three groups. Depending on the
precision of the numbers something like
> dat2$group <- cut( dat2$Var, breaks=c(-Inf, 0.1-.0001, 0.6+.0001, Inf),
labels=LETTERS[1:3])
> dat2
Var group
1 0.0 A
2 0.2 B
3 0.5 B
4 1.0 C
5 4.0 C
6 6.0 C
7 0.1 B
8 0.6 B
would also work.
-------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77840-4352