The previous solutions assume you are only interested in one small interval,
but if your original example is just a simplified version, and the real
problem is multiple, possibly large, intervals, you might want to try
something like this:

    c(NA,"A","B")[1+findInterval( <<argument>>, c(0,9+1) ) ]

which generalizes nicely to many intervals, including large ones.  The
vector c("A","B") gives the labels; c(0,9+1) specifies the intervals -- it
is 9+1 because the intervals here are closed on the left and open on the
right.

The NA and the 1+... are necessary because otherwise findInterval returns 0
for arguments less than the first interval start, which causes subscripting
to drop that element.

             -s

PS I am new to R, but solving questions like this is my way of learning it
better.  Comments by experienced R users are most welcome!

Is there a way to simplify this instruction:
>>>>>> ifelse(B=="0","A",
>>>>>> ifelse(B=="1","A",
>>>>>> ...
>>>>>
>>>>> ifelse(B=="9","A","B"))))))))))
>>>>>>
>>>>>> i am looking for something like this:
>>>>>>
>>>>>> ifelse(B=="(0:9)","A","B")
>>>>>>
>>>>>

	[[alternative HTML version deleted]]

