Entering edit mode
ALok
▴
170
@alok-2917
Last seen 10.3 years ago
Hi All,
Sorry for one basic question. My vector contains two class of group
elements, shown in different font and color
x=c(*1.1, 1.2, 1.3*, 2.1, 2.2)
I am trying to group the objects into two classes, as *1.1, 1.2, 1.3*
and
2.1, 2.2
I can use command
grep("^1.[12345678910]",x)
[1] 1 2 3
> grep("^2.[12345678910]",x)
[1] 4 5
but I am not able to automate it, using some variable k.
I have many such cases, so I want to write a iterative loop for the
structure using some variable k,
for test case, lets assume
k=1
grep("^k.[12345678910]",x)
integer(0)
Thanks in advance.
Alok
--
************************************************************
Alok Kumar Srivastava
Assistant Professor
CRRao Advanced Institute of Mathematics, Statistics and Computer
Science
(AIMSCS)
Gachibowli, Hyderabad 500046.
************************************************************
[[alternative HTML version deleted]]