Perfect! thank you On Fri, Aug 6, 2021 at 4:17 PM Bill Dunlap <williamwdun...@gmail.com> wrote: > > unlist(strsplit(vect, "\n")) > > On Fri, Aug 6, 2021 at 7:13 AM Luigi Marongiu <marongiu.lu...@gmail.com> > wrote: >> >> Hello, >> I have a vector that contains some elements with concatenated values, such >> as: >> ``` >> > vect >> [1] "name_1" >> [2] "name_2" >> [3] "name_3\nsurname_3" >> [4] "some other text\netc" >> ``` >> How can I create a new vector where each component is an element, such as: >> ``` >> > vect >> [1] "name_1" >> [2] "name_2" >> [3] "name_3" >> [4] "surname_3" >> [5] "some other text" >> [6] "etc" >> ``` >> I can split the elements on '\n' but how do I transfer these directly >> on a new vector? >> Thanks >> >> ______________________________________________ >> 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.
-- Best regards, Luigi ______________________________________________ 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.