Created
November 26, 2020 01:08
-
-
Save luisDVA/03dc43ac4ec2fd7c480baf9fbe51c785 to your computer and use it in GitHub Desktop.
Duplicates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## %######################################################%## | |
# # | |
#### Duplicates - your turn #### | |
# # | |
## %######################################################%## | |
# Load the messy Age of Empires units dataset bundled with `unheadr` (AOEunits_raw) | |
# Keep only units of Type "Cavalry" | |
# Identify duplicated records across all variables | |
# Remove duplicated records across all variables | |
# load packages ----------------------------------------------------------- | |
library(dplyr) | |
library(unheadr) | |
library(janitor) | |
# load data --------------------------------------------------------------- | |
data("AOEunits_raw") | |
# filter cavalry ---------------------------------------------------------- | |
cavalry <- AOEunits_raw %>% filter(Type == "Cavalry") | |
# duplicate records ------------------------------------------------------- | |
# identify | |
cavalry %>% get_dupes() | |
# remove | |
cavalry <- cavalry %>% distinct() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment