I want to combine two tables, using semi_join because table 2(all_drafts_adj
) forms the basis to filter table 1(draft_all_stats
).
draft_all_stats <- all_stats %>%
semi_join(all_drafts_adj, by = "Player") %>%
drop_na()
I noticed some discrepancies in the number of observations that do not match table 2 (all_drafts_adj
)'s number of observations. The differences were due to the way specific "Player" was stated in table 2 vs. table 1 (e.g. table 2 "Player" was stated as "Dennis Smith" and the same Player in table 1 was stated as "Dennis Smith Jr".
I tried using the following R script, but it replaced all Player names instead of the specific observation:
all_stats$Player <- str_remove("Dennis Smith Jr", "Jr")
Most of the transform/mutate scripts are mostly targeted at entire columns or entire observations Any on what R script to use to change specific observations with the data table?