I would like to choose rows based on the subsets of their names, for example
If I have the following data:
data <- structure(c(91, 92, 108, 104, 87, 91, 91, 97, 81, 98),
.Names = c("fee-", "fi", "fo-", "fum-", "foo-", "foo1234-", "123foo-",
"fum-", "fum-", "fum-"))
how do I select the rows matching 'foo'?
using grep() doesn't work:
grep('foo', data)
returns:
integer(0)
what am I doing wrong? or, is there a better way?
Thanks!