Создание примера данных:
set.seed(100)
library('data.table')
nums <- sample(c(11101, 11001, 10001, 99991, 99992, 99993), 52, T)
DT <- data.table(A = LETTERS, B = nums)
Использование data.table:
DT[, B := as.character(B)]
subDT <- DT[B %like% '0']
Использование data.frame и data.table:
setDF(DT)
subDT <- DT[like(DT$B, '0'),]
Использование data.frame и dplyr:
library('dplyr')
subDT <- DT %>%
filter(grepl('0', B, T))
Использование data.frame и stringi:
library('stringi')
subDT <- DT[stri_detect_fixed(DT$B, '0'),]
# if you're only interested in leading 0's
subDT <- DT[stri_detect_regex(DT$B, '^0+'),]