/ Published in: R
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
t <- c("bob_smith","mary_jane","jose_chung","michael_marx","charlie_ivan") f <- function(s) strsplit(s, "_")[[1]][1] sapply(t, f)
URL: http://stackoverflow.com/questions/1355355/how-to-avoid-a-loop-in-r-selecting-items-from-a-list