Displaying 2 results from an estimated 2 matches for "terms_include".
2011 Oct 05
2
Subsetting a data frame with multiple values and exclusions.
...ot;ind1", "ind2", "ind3", "ind4"), test1 = c(1,
2, 1.3, 3), test2 = c(56L, 27L, 58L, 2L), test3 = c(1.1, 28,
9, 1.2)), .Names = c("ind", "test1", "test2", "test3"), class =
"data.frame", row.names = c(NA,
-4L))
terms_include <- c("1","2","3")
terms_exclude <- c("1.1","1.2","1.3")
So I need to write a loop where the search of each value in the list of
terms_include is searched over the entire data frame. I thought of using
apply with grepl and subset?...
2011 Dec 05
1
Subsetting a data frame
...t;ind1", "ind2", "ind3", "ind4"), test1 = c(1,
2, 1.3, 3), test2 = c(56L, 27L, 58L, 2L), test3 = c(1.1, 28,
9, 1.2)), .Names = c("ind", "test1", "test2", "test3"), class =
"data.frame", row.names = c(NA,
-4L))
terms_include <- c("1","2","3")
terms_exclude <- c("1.1","1.2","1.3")
So in this example I want to include all the terms from terms include as
long as they don't occur with terms exclude in the same row of the data
frame.
Previously I was...