I'm trying to write a code that will exclude certain factors from sets of data/numbers.
I have written the following:
x <- c("1407741214DAG359", "2211682828DAG359", "1304410201DAG359", "0908700465DAG36", "0909700565G379")
y <- c("1407741214DAG359", "2211682828DAG359", "1304410201DAG359", "0","0")
Here i wish to exclude the values that contain DAG36
and G379
I tried writing the following:
newdata.x <- x[ x != "DAG36", "G379" ]
However, the code only seems to exclude values that exclusively contains: DAG36 and G379 and not any value containing either DAG36
or G379
.
Would any of you be able to help me?