Thank you for wanting to help
here's a reprex that has the same issue
doc_id <- c("Title A.txt",
"Title A.txt",
"Title B.txt",
"Title B.txt",
"Title B.txt")
df <- as.data.frame(doc_id)
df$category <- ifelse(doc_id %in% "A", "A", "B")
result
df
doc_id category
1 Title A.txt B
2 Title A.txt B
3 Title B.txt B
4 Title B.txt B
5 Title B.txt B
What's weird is if I use the entire doc_id string in ifelse() like so
df$category <- ifelse(doc_id %in% "Title A.txt ", "A", "B")
then it does return what I want, the problem is that the only thing I can differentiate the documents is through the A & B element