Skip to content

Instantly share code, notes, and snippets.

@luisDVA
Created November 26, 2020 01:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luisDVA/03dc43ac4ec2fd7c480baf9fbe51c785 to your computer and use it in GitHub Desktop.
Save luisDVA/03dc43ac4ec2fd7c480baf9fbe51c785 to your computer and use it in GitHub Desktop.
Duplicates
## %######################################################%##
# #
#### 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