Advertisement
Guest User

Untitled

a guest
Jun 26th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. df<- structure(list(A = structure(c(7L, 6L, 5L, 4L, 3L, 2L, 1L, 1L,
  2. 1L), .Label = c("", "P42356;Q8N8J0;A4QPH2", "P67809;Q9Y2T7",
  3. "Q08554", "Q13835", "Q5T749", "Q9NZT1"), class = "factor"), B = structure(c(9L,
  4. 8L, 7L, 6L, 5L, 4L, 3L, 2L, 1L), .Label = c("P62861", "P62906",
  5. "P62979;P0CG47;P0CG48", "P63241;Q6IS14", "Q02413", "Q07955",
  6. "Q08554", "Q5T749", "Q9UQ80"), class = "factor"), C = structure(c(9L,
  7. 8L, 7L, 6L, 5L, 4L, 3L, 2L, 1L), .Label = c("", "P62807;O60814;P57053;Q99879;Q99877;Q93079;Q5QNW6;P58876",
  8. "P63241;Q6IS14", "Q02413", "Q16658", "Q5T750", "Q6P1N9", "Q99497",
  9. "Q9UQ80"), class = "factor")), .Names = c("A", "B", "C"), class = "data.frame", row.names = c(NA,
  10. -9L))
  11.  
  12. sapply(df,function(x) length(unlist(sapply(strsplit(as.character(x),"\s+"),strsplit,split=";"))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement