r extrahieren Sie alles vor dem Charakter

library(stringr)
str = c("1", "1_ghfjv", "1")
str_extract(string = str, pattern = "[^_]"))
Trustworthy Whale