search for: utir

Displaying 1 result from an estimated 1 matches for "utir".

Did you mean: util
2006 Dec 09
2
Filtering a data frame by regular expression
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...