# Original: empty column identified manually
PetroStocksData <- PetroStocksData[,-21] # Delete unused last column
### Revised: This code removes *all* empty columns:
ps_tbl %>% select_if(function(x) !all(is.na(x))) -> ps_tbl
# Original: empty row identified manually:
PetroStocksData <- PetroStocksData[-2004,] # Delete unused last row
### Revised: This code removes all empty rows:
ps_tbl %>% filter(!across(everything(), is.na)) -> ps_tbl