Created
October 5, 2020 16:13
-
-
Save flare9x/955c4811cfab52aeddb8bdc75152b124 to your computer and use it in GitHub Desktop.
filter PSVs to leave only items without overhauls
This file contains 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
##################################### | |
# Export PSVs with EXERNAL / DEFAULT schedules (own export) | |
# Find PSVs with NO OVERHAUL schedule (own export) | |
# Compare - filter by no overhaul | |
##################################### | |
# load data | |
externals = read.csv("C:/Users/Andrew.Bannerman/Desktop/MARS/PSV KPI project/externals.csv") | |
internals = read.csv("C:/Users/Andrew.Bannerman/Desktop/MARS/PSV KPI project/overhauls.csv") | |
all = read.csv("C:/Users/Andrew.Bannerman/Desktop/MARS/PSV KPI project/externals_def_relief.csv") | |
# filter by unique value | |
ext_vector = externals$Equipment_Equipment.ID | |
int_vector = internals$Equipment_Equipment.ID | |
# subset only relief valves - will leave DEFAULT and EXTERNAL | |
subset_df = subset(all, all$Equipment_Equipment.Group_Name == "RELIEF VALVE" & all$Active == "True") | |
# filter only DEFAULT and EXTERNAL schedule drivers | |
schedule_df = subset(subset_df, subset_df$Schedule.Driver_ScheduleDriver == "EXTERNAL" | subset_df$Schedule.Driver_ScheduleDriver == "DEFAULT") | |
schedules = unique(schedule_df$Schedule.Driver_ScheduleDriver) | |
schedules | |
head(externals) # Equipment_Equipment.ID | |
head(internals) # Equipment_Equipment.ID | |
head(all) # Equipment_Equipment.Group_Name | |
all_group_list = unique(all$Equipment_Equipment.Group_Name) | |
# filter by unique value | |
ext_vector = schedule_df$Equipment_Equipment.ID | |
int_vector = internals$Equipment_Equipment.ID | |
# filter out items with no overhauls | |
filter_df <- subset(schedule_df , !(ext_vector %in% int_vector)) | |
# write to csv | |
write.csv(filter_df, "C:/Users/Andrew.Bannerman/Desktop/MARS/PSV KPI project/PSVs_no_overhauls.csv") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment