search for: db_new

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

2011 Dec 05
1
Subsetting a data frame
...I would like to know if there is a way to write a similar function that looks for matches that start with the query string: as in grepl("^pattern",x) I started writing a function but am not sure how to get it to return the dataframe or matrix: for (i in 1:length(terms_include)){ db_new <- apply(db,2, grepl,pattern=i) } Applying this function gives me: db_new <- structure(c(FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE), .Dim = c(4L, 4L), .Dimnames = list(NULL, c("ind", "test1", "test2...