Is there a way to remove rows from a dataframe, based on the column of another dataframe?
For example, Dataframe 1:
Gene CHROM POS REF ALT N_INFORMATIVE Test Beta SE
AAA 1 15211 T G 1481 1:15211 -0.0599805 0.112445
LLL 1 762061 T A 1481 1:762061 0.2144100 0.427085
CCC 1 762109 C T 1481 1:762109 0.2847510 0.204255
DDD 1 762273 G A 1481 1:762273 0.0443946 0.119924
Dataframe 2 (only 1 column):
Genes
AAA
BBB
CCC
DDD
EEE
FFF
In this situtation, I want to scan Dataframe 1, column 1 for any matches to Dataframe 2, and remove matching rows.
They need to be an exact match, and the result would look like this:
Gene CHROM POS REF ALT N_INFORMATIVE Test Beta SE
LLL 1 762061 T A 1481 1:762061 0.2144100 0.427085
I've tried variations of this, but it hasn't worked:
NewDataframe <-!(Dataframe1$Gene==Dataframe2$Genes)
Thanks for reading.