# NOT RUN {
sheet_title <- c("cat", "catherine", "tomCAT", "abdicate", "FLYCATCHER")
ss <- lapply(paste0("TEST-", sheet_title), gs_new)
# list, for safety!, then delete 'TEST-abdicate' and 'TEST-catherine'
gs_ls(regex = "TEST-[a-zA-Z]*cat[a-zA-Z]+$")
gs_grepdel(regex = "TEST-[a-zA-Z]*cat[a-zA-Z]+$")
# list, for safety!, then delete the rest,
# i.e. 'TEST-cat', 'TEST-tomCAT', and 'TEST-FLYCATCHER'
gs_ls(regex = "TEST-[a-zA-Z]*cat[a-zA-Z]*$", ignore.case = TRUE)
gs_grepdel(regex = "TEST-[a-zA-Z]*cat[a-zA-Z]*$", ignore.case = TRUE)
## using gs_vecdel()
sheet_title <- c("cat", "catherine", "tomCAT", "abdicate", "FLYCATCHER")
ss <- lapply(paste0("TEST-", sheet_title), gs_new)
# delete two of these sheets
gs_vecdel(c("TEST-cat", "TEST-abdicate"))
# see? they are really gone, but the others remain
gs_ls(regex = "TEST-[a-zA-Z]*cat[a-zA-Z]*$", ignore.case = TRUE)
# delete the remainder
gs_vecdel(c("TEST-FLYCATCHER", "TEST-tomCAT", "TEST-catherine"))
# see? they are all gone now
gs_ls(regex = "TEST-[a-zA-Z]*cat[a-zA-Z]*$", ignore.case = TRUE)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab