I have a df
like below
df <- structure(list(V1 = structure(c(3L,),
class = "factor")),
.Names = c("V1", "V2", "V3"), class = "data.frame",
row.names = c(NA, -7L))
I want to remove part of string in each cell after the first |
so the output looks like this
out<- structure(list(V1 = structure(c(3L, 2L, 4L, 1L, 6L, 5L, 7L), .Label = c("O15111",
"P41250", "P62805", "Q13547", "Q16555", "Q8NBS9", "Q9H6T3"), class = "factor"), ta.frame", row.names = c(NA, -7L))