Использование apply
:
df$col <- apply(df, 1, function(x) grep("N0\\d{2}W", x))
Данные:
df <- structure(list(test1 = structure(1L, .Label = "jsb cjn", class = "factor"),
test2 = structure(1L, .Label = "kd N069W j", class = "factor"),
test3 = structure(1L, .Label = "N9DSW ", class = "factor")), class = "data.frame", row.names = c(NA,
-1L))