Return to Snippet

Revision: 22203
at January 5, 2010 17:45 by rlvesco7


Initial Code
t <- c("bob_smith","mary_jane","jose_chung","michael_marx","charlie_ivan")

f <- function(s) strsplit(s, "_")[[1]][1]

sapply(t, f)

Initial URL
http://stackoverflow.com/questions/1355355/how-to-avoid-a-loop-in-r-selecting-items-from-a-list

Initial Description

                                

Initial Title
How to avoid a loop in R: selecting items from a list - Stack Overflow

Initial Tags

                                

Initial Language
R