Hi everybody, I have a vector of character strings. Each string has the same pattern and I want to split them in pieces and get a vector made of the first pieces of each string.
The problem is that strsplit returns a list. All I found is uu<- matrix(unlist(strsplit(x,";")),ncol=3,byrow=T)[,1] where x is the vector ";" is the delimiting character and I know that each string will be cut in 3 pieces. That works for my problem but I would prefer a more elegant solution. Besides, it would not work if all the string didn't have the same number of pieces. does someone have a better solution? sorry if that topic was discussed recently. There is too much traffic on the r-help list, I cannot catch up. -- Eric Elguero ------------ MIVEGEC. - UMR (CNRS/IRD/UM) 5290 Maladies Infectieuses et Vecteurs, Génétique, Evolution et Contrôle Institut de Recherche pour le Développement (IRD) 911, Avenue Agropolis BP 64501 34394 Montpellier Cedex 5, France ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.