I am trying to subset a data based on a column value. I am trying to subset if that specific column has only one level information. Here how my data look like.
data <- cbind(v1=c("a", "ab", "a|12|bc", "a|b", "ac","bc|2","b|bc|12"),
v2=c(1,2,3,5,3,1,2))
> data
v1 v2
[1,] "a" "1"
[2,] "ab" "2"
[3,] "a|12|bc" "3"
[4,] "a|b" "5"
[5,] "ac" "3"
[6,] "bc|2" "1"
[7,] "b|bc|12" "2"
I want to subset only with the character values that were not including "|", like below:
> data
v1 v2
[1,] "a" "1"
[2,] "ab" "2"
[3,] "ac" "3"
basically, I am trying to get rid of two-level (x|y) or three level values (x|y|z). Any thoughts on this?
Thanks!