Вы можете использовать stringi
, чтобы сделать нечто подобное:
library(stringi)
df[stri_detect_fixed(df$src_address, "."),]
Или, если вы хотите использовать grepl
, вы можете использовать fixed = TRUE
, поэтому вам не нужно экранировать ".":
df[grepl(".", df$src_address, fixed = TRUE), ]
Данные:
df <- structure(list(src_address = c("1.11.201.19", "1.119.43.90",
"1.119.43.90", "1.119.43.90", "1.171.43.133", "1.179.191.82",
"1.179.191.82", "1.179.191.82", "1.180.72.186", "1.202.165.40",
"1.203.84.52", "1.203.84.52", "1.209.171.4", "1.214.34.114",
"1.214.34.114", "101.53.137.245", "101100148143", "101100148143",
"101231185170", "101231185170", "101231185170", "103.1.94.102",
"103.12.195.158"), dest_address = c("172.16.16.100", "172.16.16.100",
"172.16.16.153", "192.168.1.112", "172.16.16.5", "172.16.16.5",
"192.168.1.111", "192.168.1.112", "172.16.16.153", "172.16.16.153",
"172.16.16.5", "192.168.1.112", "192.168.1.111", "172.16.16.100",
"172.16.16.153", "172.16.16.5", "192.168.1.111", "192.168.1.112",
"172.16.16.100", "172.16.16.153", "192.168.1.112", "192.168.1.112",
"172.16.16.5"), all_attemps = c(1L, 1L, 1L, 1L, 2L, 1L, 2L, 2L,
2L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L),
max_byte = c(60L, 60L, 60L, 60L, 52L, 60L, 60L, 60L, 60L,
60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L,
52L, 52L), avg_byte = c(60L, 60L, 60L, 60L, 48L, 60L, 60L,
60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L, 60L,
60L, 60L, 52L, 52L), activity_rate = c(0.005434783, 0.005434783,
0.005434783, 0.005434783, 0.010869565, 0.005434783, 0.010869565,
0.010869565, 0.010869565, 0.005434783, 0.005434783, 0.005434783,
0.005434783, 0.010869565, 0.010869565, 0.010869565, 0.010869565,
0.010869565, 0.005434783, 0.005434783, 0.005434783, 0.005434783,
0.005434783)), .Names = c("src_address", "dest_address",
"all_attemps", "max_byte", "avg_byte", "activity_rate"), row.names = c(NA,
-23L), class = "data.frame")