I have a vector with the following values:
list <- c("test_data", "train_data", "random_forest_output", "xgboost_output", "light_gbm_output", "all_output", "all_output_final")
I need to select all variables that contain "output" word, but in the case of values "all_output" and "all_output_final" I need to choose only the "all_output_final".
That is, I need to get a list like this:
new_list <- c("random_forest_output", "xgboost_output", "light_gbm_output", "all_output_final")
Is it possible to implement using a regular expression?