I have 2 data.frames
. 1 is guest_list and the other event_list. I am trying to remove rows in the guest_list if Guest_list$name == event_list$host
. I have been looking up the Remove Rows Threads on here but have not found the one that matches my inquiry.
Here are the two DFs
:
event_list<-`data.frame(event=c('ONE','TWO','THREE'),event_type=c('A','B','C'),host=c("FAKE NAME","FAKE NAME","FAKE NAME","BOB","BOB","BOB"),stringsAsFactors = FALSE)`
EVENT | EVENT_TYPE | HOST
ONE | A | FAKE NAME
TWO | B | FAKE NAME
ONE | A | BOB
TWO | B | BOB
SECOND DF
guest_list<-data.frame(name=c('FAKE NAME','JEFF JEFF','JOHN SMITH','BOB'),guests=c(3,2,2,2),stringsAsFactors = FALSE)
NAME | GUESTS
FAKE NAME | 3
JEFF JEFF | 2
JOHN SMITH | 2
BOB | 2
Expected result:
NAME | GUESTS
JEFF JEFF | 2
JOHN SMITH | 2
I wish I had some code to offer but I am only thinking if statements which I also dont think is correct.