I am working in R and am trying to remove closing parenthesis only when there is no opening parenthesis. I have tried below and it is not returning the desired output.
test <- data.frame(t1 = c("Book (Pg 1)", "Website Online)", "Journal: 2018)"))
test
test$t2 <- ifelse(str_contains(test$t1, "("), test$t1, gsub("(", '', test$t1))
I am hoping to return test$t2 as "Book (Pg1)", "Website Online", "Journal: 2018"