Hello,

I am having difficulty filtering a data frame.

I would like to take all the rows of a data frame where column A contains
the regular expression "UTI" (or some other regex). Here's what I've got:

utiRE <- function (avector) {
occurs <- c()
r1 <- "UTI"
for (x in avector) {
if (!is.na(grep(r1,x,perl=TRUE))) {
occurs <- c(occurs, TRUE)
} else {
occurs <- c(occurs, FALSE)
}


I know this is a clunky way of doing it, but I tried more natural ways first
(i.e. without iteration), to no avail. I think the problem is that when I
iterate through the list, the strings in avector get turned into numbers.

Any solutions?

Thanks!
-- 
Ubuntu Linux 6.06 (Dapper Drake)

	[[alternative HTML version deleted]]


