0

Consider below as data frame

test1 test2 test5
1a     dsa    xx
1c     ad     xxxx
1e     as     cccxx
2f     ssa    xxxxx
2a     bs     xxxx
2s     bs     xxzzx

I want to create a Subset which has "1" in test1 and "a" in test2, like the below one

test1 test2 test5
1a     dsa    xx
1c     ad     xxxx
1e     as     cccxx

I tried the following method

test4 = (test3[ grep("1", test3$test1),] & test3[ grep("a", test3$test2),])

but does not work

Praveen DA
  • 348
  • 4
  • 15

0 Answers0